Object orientation is probably the most dominant programming paradigm today. Some people say, there are certain disadvantages, flaws or faults to this paradigm. Some even consider it a complete failure. What are the concrete reasons/arguments for that?
What I found the biggest flaw of OOP is that the most prominent frameworks/methods encourage writing not object-oriented code. If we are developing service and DAO layer with no state at all (just business methods passing arguments from layer to layer) and have a domain model with no logic at all (just a bunch of fields and maybe getters/setters/properties), it is no longer OOP. Most of the enterprise projects, even considered to be well written, aren't actually object oriented. They have a collection of functions grouped together in logical namespaces (called classes) and a collection of data structures, having private fields to annoy programmers (called domain). The domain does not have any operations.
IMHO OOP model was sacrificed in enterprise applications because it does not handle concurrency properly (or maybe because people prefer to have a stable set of objects rather than creating new instance per request ?!?). This is probably the reason why functional languages (and immutable objects to some degree) are getting much more attention.
On the other hand, are immutable objects actually in the spirit of OOP? I am not sure.
精彩评论