Recently I got an email from someone pointing out that doing proper Single Responsibility Principle, often resulted in classes which had exactly one method. Odd? Well, actually, it is a function in disguise.
There isn’t such a thing as a class that does too little. If there is a reason for a class to exist it will manifest in your code whether you choose to ignore it or not. Worse it won’t stay hidden but will plague the design of the rest of your code.
Classes not only aid in your design but also sed light on the problem domain you are currently trying to solve. They allow you to see further. If you don’t have classes, you can’t think of relationships.
Adding methods, whether static or not, keep your code from evolving. They are not extensible since you need to
add a new one every time and don’t allow your code to be treated uniformly creating unnecessary complexity which could have been avoided otherwise.
So the next time you are tempted to add a new method, stop. Think whether it really makes sense or is a mere illusion to feed your appetite for code.
Notice how you can easily introduce more Operations effectively extending Formula through composition
This might look like a trivial example that rarely applies in a real life scenario. In my experience this is not the case. Think of bytes and sockets, sql and jdbc connections, queries and services, http requests and clients, messages and message dispatchers.