Steve yegge wrote an article called "Execution in the Kingdom of Nouns" back in 2006, 14 years later I still find the points he made valid. For example, "Action is what gives life its spice... (but) Object Oriented Programming puts the Nouns first and foremost ... nouns are things, and things are prized beyond all actions in the Kingdom of Java".
The example he used still resonates with me. Most of time when I write the a piece of codes to do a task, it normally consists of a serial of actions. Using his example of taking out the garbage to illustrate the the point,
/*To take out the the garbage*/
get the garbage bag from under the sink
carry it out to the garage
dump it in the garbage can
wash my hands
get back to my couch
...
what I need here are a serial of actions, not a serial of nouns like
A GarbageDisposalStrategy nouns,
A GarbageDisposalDestinationLocator nouns for finding my way to the garage,
A PostGarbageActionCallback nouns for putting me back on my couch.
...
I have seen too many codes with all kinds of manager classes, with public methods like run(), execute() or dothis().
And let me give a more realistic example to further illustrate my point. People always say choosing the right paradigm for the right problem. So let's take web development as an example. In web development we have lots of OOPs and frameworks, not just in java. But even since I use nodejs (express) to do web development I never use OOP, never miss it. Express's middleware is just a function chain.
So both OOP and procedural design work well for web development. But with express I feel far more easier, I spend more time in developing the "real" code instead of learning the frameworks and all the design and twist in the framework.
What is the "right" paradigm for web development?
What are the disadvantages of OOP, especially in java (in web development & in general)? Does OOP overemphasize the importance of noun and thus put action/verb in the less importance position ?
I also need to emphasize that my question is not to discuss/promote functional programming or to start a language war. I am fully aware that my question maybe seen as opinion-based or too broad. But the fact that 14 years later the problem is still here makes me ask this question.
---- update ----
One more vote and my post will be deleted. But please, the future readers, don't vote to delete it, it has been closed, why delete it? I do think it raises a valid concern, why delete it?
Although my question was closed (as I expected) I want to point out that there was a same question at stackoverflow (before I changed my question title), which was also closed https://stackoverflow.com/questions/2853316/disadvantage-of-oop
There are some good answers there so if you have interest take a look. An answer I quite agree is (maybe because many of my codes are transformative processing)
OOP works best with large-scale, multi-developer, multi-module projects. For "development in the small" - such as scripting or transformative processing, it can require a good deal of overhead without necessarily adding value.
...
transformative processing is quite amenable to the functional style of programming
PS, if you think Steve yegge's article is gibberish, you may check Joe Armstrong(father of erlang) article Why OO Sucks, much shorter, straight to the points and yet basically made the same arguments, like "Data structure and functions should not be bound together."
GetGarbageBag(sink)
, and it stays that way - with no explicit separation of concepts or control over unwanted accidental coupling, which happens as the code changes and grows. 1/3TakeOutGarbage()
function, even though they may leave the// take out the garbage
comment above that sequence. So they never come to the step where they change it toTakeOutGarbage(then: () => GetBackToCouch())
because maybe they realized that this happens to be a better, cleaner design for their particular problem. Instead, it just gets more complicated and tangled. This is how you end up with 1000 line functions. 2/3