2

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.

13
  • Since version 4.8 GCC is written in C++.
    – Chnossos
    Jul 31, 2014 at 10:34
  • 2
    You can implement an object-oriented design in a procedural language like C. Regarding your question: there are programmers that are not convinced OOP is a better choice for any project, and prefer to use some other paradigm.
    – Giorgio
    Jul 31, 2014 at 10:36
  • 2
    @Fish: yes, e.g. functional programmers will not use OOP, unless they choose a hybrid functional-OO language like Scala in which you can combine the two paradigms.
    – Giorgio
    Jul 31, 2014 at 10:48
  • 1
    A compiler is not such a large project.
    – Random42
    Jul 31, 2014 at 12:25
  • 1
    @Doval: I may be wrong. I found some interesting ideas in SICP. If I understand it correctly, a distinguishing feature of object-oriented programming is the use of message passing (dynamic dispatch) instead of dispatching on type using 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.
    – Giorgio
    Jul 31, 2014 at 14:09

1 Answer 1

10

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.

4
  • 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.
    – Giorgio
    Jul 31, 2014 at 11:07
  • 2
    Thats correct even for procedural programming! However, OOP actively encourages these features and have established them in mainstream development.
    – theD
    Jul 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
  • 1
    That 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!
    – theD
    Jul 31, 2014 at 12:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.