Is object oriented programming always the good way for all types of projects? Is this methodology the best suited for large projects like compilers, interpreters and other large systems? Most of the compilers are written in C so I can't see any compilers written in the object oriented method. I think OOP benefits the most in places like LOB, simulations where you can consider everything as an object. But is it really useful in all places? Also OOP can lead to inefficient code than procedural code. Not to mention that design patterns sometimes increase the complexity of design.
1 Answer
Lets try to understand why OOP became popular. It is because of the maintainability problem. Any large codebase has to be just as maintainable as small codebase. Since, OOP features decoupling, modularity, reuse, etc., it helps developing maintainable code. Also, nowadays performance issues are often neglected in favor of maintainability because with advanced algorithms and faster hardware, performance issues can be limited to an acceptable level.
However, there are projects for which different programming paradigms are preferred. Primarily because these projects have different goals. For instance, functional reactive programming have come to fashion for event-based and asynchronous systems development.
So, to answer your question, OOP is the most popular programming paradigm in use now. OOP programmers often times, either out of enthusiasm or ignorance, try to apply it to develop solutions that should be developed using other paradigms.
-
11"Since, OOP features decoupling, modularity, reuse, etc., it helps developing maintainable code.": All these features are available in procedural and in functional languages, so they are not OOP-specific.– GiorgioJul 31, 2014 at 11:07
-
2Thats correct even for procedural programming! However, OOP actively encourages these features and have established them in mainstream development.– theDJul 31, 2014 at 11:15
-
4"OOP features decoupling, modularity, reuse, etc., it helps developing maintainable code" - Hmmm yeah, but if the programmers are not doing it right, it doesn't matter. And in my experience, most are not doing it right. (Just making a remark, not criticizing the answer... ;)) Jul 31, 2014 at 12:36
-
1That is correct. The primary reason I would say is that the ivory tower OOP masters have failed us by documenting OOP which read like journal papers! Think about the time investment of a typical OOP developer to learn it!– theDJul 31, 2014 at 12:55
if (x instanceof ...)
like in Java or using pattern-matching like in FP (see mitpress.mit.edu/sicp/full-text/book/…). A second distinguishing feature (see mitpress.mit.edu/sicp/full-text/book/book-Z-H-19.html), is the use of state, which OO has in common with procedural programming: both are imperative paradigms.