Alternatives to Object-Oriented Programming?

Viewed 36270

OOP is probably the most used programming paradigm in today’s software design. My question is – what other paradigm(s) can compete with it and can stand in the place of OOP? To clarify that question, I’m not asking about what other paradigms there are. There are many of them, but I’d like to know which one…

  • Has been used in practice, not only in theory.
  • Can compete with OOP, so it can be used in a large project with a minimum of pain.
  • Can be used to develop a desktop app with business logic, databases, and so on.
  • Is not used alongside OOP, but as a replacement for OOP.

And if there is any, what are the pros/cons of it, why it is better/worse than OOP, what languages are the best to use it, what about using it in popular languages, has it any design patterns, and can it totally replace OOP?

6 Answers

First of all please note that many of the programming languages currently in use (especially "higher level languages") are multi-paradigm. That means you are never building programs which are purely OOP (except if you use Smalltalk or Eiffel to build your big projects maybe).

Have a look at PHP for instance:

  • Has many elements of OOP (since version 5)
  • Was mostly procedural before
  • Has elements of declarative programming (e.g. the array functions)
  • Implemented many elements of functional programming (since version 5.4)

Basically PHP is gluing a lot of different paradigms together (and is a "glue language" itself).

Also Java implements a lot of concepts which are not from the Object-Oriented paradigm (e.g. from functional programming).

Have a look on the list of programming languages by type in Wikipedia: https://en.wikipedia.org/wiki/List_of_programming_languages_by_type#Imperative_languages (not 100% accurate).

Functional programming (subset of declerative programming)

  • Wideley used in practice (it became part of glued languages like PHP, also Java and many others have implemented concepts of functional programming)
  • Many ideas originate in LISP which is definitely worth a look
  • You can build whole applications e.g. with Haskell therefore it can "replace" OOP

Procedural programming

  • C (as a mostly procedural language) is still one of the most widely used languages
  • Many modern glue-languages were procedural in the beginning
  • Still many programs are mostly procedural (so if you want it can "replace" OOP)

Logical programming

  • Most prominent example is Prolog. This is used for specific tasks that benefit from rule-based logical queries
  • Can not "replace" OOP in terms of building a large project but may replace it in other terms

Declarative / Domain-specific languages in general

  • Using SQL in your projects? Then they are not purely OOP, SQL is essentially declarative.
  • Many domain-specific languages (like CSS) are declarative

Imperative programming in general

This list is not complete it shall just give an idea. Just note that you usually are using a lot of different paradigms when writing a big application and even each language you are using is implementing multiple paradigms.

OOP is usually considered a good choice for structuring large, complex relationships when modelling data. It is not always the paradigm to go with for many other tasks.

Related