Recently I encountered the phrase: “Simplicity favors regularity”. This phrase is from the book Computer Organization and Design: The Hardware/Software Interface.
A question was asked:
There are many crucial technical concepts such as instruction set architecture
and endianess that Computer Scientists and Engineers must understand. The
general principles that guide processor design, however, are perhaps the
most compelling in their application to our daily design process. In the spirit
of the design principle “Simplicity favors regularity” should programmers make
their schemas as rigid as possible, preferring to define fewer types of data
structures and generalizing them to many tasks in a system, even though it
might require more lines of code?
This is an interesting question – one I have been pondering lately in the design of data structures for Simple IoT. So far, this approach seems to be working out well. Sometimes you do need to write a few more lines of code to translate between a generic datatype and something specific, but the bulk of the application can remain untouched, which is a huge benefit.
The advice to keep Go interfaces small also follows this line of thinking.