CUPID – the back story
I&#x27;m not a huge fan of SOLID, but when writing OOP in a conventional style, I have found that it works pretty well. All the principles play nicely with each other. You don&#x27;t have to write SOLID, but you probably shouldn&#x27;t write Java code like you&#x27;re a Haskell developer because that&#x27;s not a natural or common way to write Java.<p>Writing simple code is great. For when you can write simple code. For everything else, people invented things like SOLID. We need and want to do complicated things and maintain complicated codebases. If you want to do simple things simply, I&#x27;m not even sure OOP is a great model, let alone SOLID, which is an attempt at simplifying people&#x27;s OO constructions. For all intents and purposes, SOLID is how, in fact, you write simple code in complicated projects.<p>&quot;Single responsibility&quot; is a much better heuristic than &quot;fits in my head&quot; because code expands and gets bigger. It fits in your head now, but no decently sized, actively developed project stays simple. When do you break it up? When it starts taking on multiple responsibilities. Yes, that isn&#x27;t objective. But the alternative proposed is even less objective. Additionally, &quot;fits in your head&quot; is inferior because it assumes you already understand the codebase. If you are new to the code base, trying to weave through the functions and objects called to figure out what it does, looking at code that does multiple things is confusing and hard to synthesize without first understanding the whole. And you can&#x27;t understand the whole until you understand the pieces. Single responsibility is much more specific and identifiable than the author&#x27;s alternative.<p>The author mis-attributes the Open-Closed principle to a performance optimization. The open-closed principle allows me to make assumptions about what a class is doing and how it behaves. This is because I know it hasn&#x27;t been modified. Wikipedia notes that the original formulation of the term, a closed class or module &quot;has been given a well-defined, stable description.&quot; The point here is that if you don&#x27;t let something be fundamentally changed during runtime, then you can reason about it. It is definitely not a performance hack.<p>The author states that the Liskov Substitution Principle is the principle of least surprise, which is surprising as you cannot substitute one principle for the other. This suggests to me that the author does not actually understand the meaning of this principle, especially as he fails to give a substantive critique and unhelpfully declares that you should write simple code. The Liskov Substitution principle is, again, how we reduce the apparent complexity of code so it allows us to reason about it more effectively.<p>This next one is baffling. The author of this article recounts the anecdote showing an instance where the interface segregation principle would have been helpful in designing the code. However, the author appears to be unable to gleam from that anecdote the underlying principle being advocated and is fixated on the fact that in the story the code was refactored. Since the anecdote describes an implementation, the author is unable to see it as anything other than a design pattern.<p>The author claims this principle has cost billions of dollars in damage. He does not feel the need to explain this or provide a citation. Just, you know, billions of dollars in damage. Like we just all know that this powerful decoupling principle just set a large fortune on fire and this is plainly obvious to everyone. Next he says &quot;the real principle here is option inversion.&quot; No, it isn&#x27;t. I don&#x27;t know where the author got this from. But I suspect given what he&#x27;s said previously that it just sort of made sense to him and then decided that must be what this principle is about without any further discussion. But the author is none the less actually correct that you can over-use this principle to over-complicate code before it really needs to be that complicated. These are, of course, ultimately rules of thumb that work well together. Common sense and experience are still required.<p>Robert C. Martin has an unusual habit of giving advice that sounds kind of stupid at first glance, until you actually try it out for yourself. His &quot;rules&quot; often have hidden reasons behind them that only become clear when you write code with them. I suspect that the author did not give SOLID a serious shake as his criticisms all sound strongly like someone who read about SOLID, failed to internalize their meaning or give the technique a try, and is now attacking a strawman with advice that, quite unlike Robert C. Martin&#x27;s style, sounds okay at first glance, but you quickly realize does not translate into actionable advice when you&#x27;re coding. I&#x27;ve heard &quot;fits in your head&quot; before. It sounds like what you want, but it does not allow you to identify problems early and predict what sorts of changes you might need to make to the code to prevent those problems. Especially if you&#x27;re a beginner, try writing according to SOLID principles. See if it helps. After you understand why those are the principles and why they all go together by seeing what sorts of decisions it causes you to make in your own code, you&#x27;re free to ignore it having at least learned what the advice actually is.