Principles are not rigid rules, they cannot be applied universally in every situation. This is evident in the fact that some principles can contradict one another.
The significance of each principle lies not in the principle itself but in the problem it seeks to address. That’s why it is imperative when learning a principle to understand why this principle was made, the problem the principle solves is more important than the principle.
By learning various principles, we learn to identify potential problematic areas in our code. This understanding allows us to make informed decisions: Do we believe this issue will negatively impact our codebase in the future? If the answer is yes, we already have a relevant solution in mind, along with its pros and cons, enabling us to decide whether to implement that solution.
Think of your code as a recipe with two distinct audiences. One audience is the compiler, which transforms your code into a binary that fulfills the required functionality. The other audience consists of people, yourself or other programmers, who will interact with the code you write. Just as code solves problems for the end user, it should also solve problems for developers. Specifically, your code should be easy to test, debug, modify, and work on collaboratively.
In summary, learning programming principles helps us recognize potential issues in our codebase. Once we identify these issues, we need to determine whether they will significantly impact us. If they do, we can then weigh the pros and cons of applying the relevant principle.
So, too clean code is the code that we write that doesn’t solve any of the problems mentioned.
The same is true for the programming patterns, for the performance and in general with everything related to coding. Our job is not merely to write code, it is to solve problems by writing code. Code that doesn’t solve real, existing problems is a liability.