OOP
ObjectRelationalMapping
BondageAndDisciplineLanguage
ObjectObsessedProgramming
FunctionalProgramming
object-oriented design is the roman numerals of computing.[1]
Criticism & Alternatives
- Objects Have Failed by DickGabriel
- [Objects] were for modeling and building complex, dynamic worlds
- But with C++ and Java, the dynamic thinking fostered by object-oriented languages was nearly fatally assaulted by the theology of static thinking inherited from our mathematical heritage
- And as a result we find that object-oriented languages have succumbed to static thinkers who worship perfect planning over runtime adaptability, early decisions over late ones, and the wisdom of compilers over the cleverness of failure detection and repair.
- good points from the essay:
- The object-oriented approach does not adequately address the computing requirements of the future.
- Powerful concepts like encapsulation were supposed to save people from themselves while developing software, but encapsulation fails for global properties or when software evolution and wholesale changes are needed.
- Objects promised reuse, and we have not seen much success.
- Objects require programming by creating communicating entities, which means that programming is accomplished by building structures rather than by linguistic expression and description through form, and this often leads to a mismatch of language to problem domain.
- http://www.dreamsongs.org/Files/ObjectsHaveFailed.pdf
- http://www.dreamsongs.org/ObjectsHaveNotFailedNarr.html
- http://www.dreamsongs.org/Files/ObjectsHaveFailedSlides.pdf - very nice slides
- Encapsulation
- I believe that encapsulation has failed because it is all about program evolution, and in real life, evolution doesn’t take place in the ways we expect it to. A very good programmer might write a very good class (with public, protected and private state and methods spelled out just so) only to find that the requirements have changed drastically in the next release, and the class need to be further factored, generalized, parameterized or virtualized to accommodate the new requirements.
Whether it is clear or not, the mental processes of the programmers who wrote these different versions was quite different. The hacker wanted to get the immediate job done at all cost. The procedural programmer views the nature of computation as a decomposition of a function into sub-functions (helper functions) that solve sub-problems. The object-oriented programmers see the nature of computation as a swarm of interacting agents that provide services for other objects. Further, the sophisticated OO programmer lets the system take care of all polymorphic tasks possible. This programmer sees the essence of object oriented programming as the naive object-oriented programmer may not.
The above makes it sound like the evolution of man where fish are the hackers, apes are procedural programmers, and OO'ers are humans. I find this fallacious, especially when procedural is combined with RDBMS such that set theory and predicate logic provide a high-level abstraction. Polymorphism is limited because it forces you into mutually-exclusive divisions or taxonomies. Power comes from having a grab-bag of features that does not force you to pick only certain groupings of features.
Please show me a case where inheritance and/or full data encapsulation makes sense for business/domain objects on the implementation level.
- you end up calling something like address.Validate() and from there it's really a small step to separate out code and data into a message and a service that deals with it and call Validate(address).
- Objects lost (except on the abstract and conceptional analysis level where they are useful to understand a problem space) their place in that picture for me.
there must have been an explosion at the pattern factory [2]
Object-oriented programming generates a lot of what looks like work. Back in the days of fanfold, there was a type of programmer who would only put five or ten lines of code on a page, preceded by twenty lines of elaborately formatted comments. Object-oriented programming is like crack for these people: it lets you incorporate all this scaffolding right into your source code. Something that a Lisp hacker might handle by pushing a symbol onto a list becomes a whole file of classes and methods. So it is a good tool if you want to convince yourself, or someone else, that you are doing a lot of work. [3]