1. How does the single responsibility principle improve Go code?
By applying the single responsibility principle, the complexity of our code is reduced as it is decomposed code into smaller, more concise pieces.
With the smaller, more concise pieces, we gain increases in the potential usability of that same code. These smaller pieces are easier to compose into larger systems, due to their lighter requirements and more generic nature.
The single responsibility principle also makes tests simpler to write and maintain because when a piece of code has only one purpose, there is only much less scope (and therefore complexity) required to test.
Â
2. How does the open/closed principle improve Go code?
The open/closed principle helps reduce the risk of additions and extensions by encouraging us not to change existing code, particularly exported...