Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When is Object Oriented not the correct solution? [closed]

I've encountered lately some opinions saying that Object Oriented design/programming should not always be used.
Do you know some use-cases that will not benefit from and should not use Object Oriented design?

For example: there are some problems (concerns) that will benefit from AOP.

like image 815
Shimi Bandiel Avatar asked Oct 29 '08 13:10

Shimi Bandiel


People also ask

When would you not use object-oriented programming?

These include: design patterns, abstraction, encapsulation, modularity, polymorphism, and inheritance. When not to use OOP: Putting square pegs in round holes: Don't wrap everything in classes when they don't need to be. Sometimes there is no need and the extra overhead just makes your code slower and more complex.

What object-oriented concepts are needed to implement the Open Closed Principle?

In object-oriented programming, the open–closed principle states "software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification"; that is, such an entity can allow its behaviour to be extended without modifying its source code.

What are not true regarding object oriented design?

An object can instantiate two classes is not true about the object oriented design of software.

What's wrong with object-oriented?

There is no objective and available evidence that object-oriented programming is superior to procedural programming. OOP code is non-deterministic, which means that, unlike functional programming, we can't always expect the same result from the same inputs. This makes it difficult to reason about the programme.


2 Answers

Some problems are best expressed using other paradigms such as Functional Programming. Also, declarative paradigms allow more robust formal reasoning about the correctness of the code. See Erlang for a good example of a language with certain advantages that can't really be matched by OO languages due to the fundamental nature of the paradigm.

Examples of problem domains where other language paradigms have a better fit are database queries (SQL), expert systems (Prolog, CLIPS etc.) or Statistical computing (R).

like image 85
ConcernedOfTunbridgeWells Avatar answered Oct 18 '22 22:10

ConcernedOfTunbridgeWells


In my experience one of the places that does not benefit from OO design is in low end embedded systems. There is a certain amount of overhead required to do OO and there are times you cannot afford this overhead. In a standard PC the overhead is so minimal it’s not even worth considering, however in low end embedded systems that overhead can be significant.

like image 22
Rossini Avatar answered Oct 18 '22 20:10

Rossini