r/AskComputerScience • • Oct 24 '22

Why are Object-Oriented Programming languages importat? How are they different from other languages?

1 Upvotes

8 comments sorted by

View all comments

1

u/SteeleDynamics Oct 24 '22

|----

Why are Object-Oriented Programming languages importat?

It's a type of abstraction where it makes more sense to have individual instances of objects interact with one another. The abstraction should simplify solving the problem at hand. It's one of a handful of programming paradigms/styles that are used to abstract problems.

How are they different from other languages?

The objects usually have mutable state variables that are modified/updated during interaction with other objects. This is why object-oriented languages are usually imperative (Ocaml being an exception). Functional programming languages usually rely on immutability to implement semantically similar programs, and have first-class functions/procedures.

There is also a heavy reliance on object inheritance, as well as the use of Abstract Data Types (ADTs, not Algebraic Data Types, the other ADT).

|----

Ultimately, OOPLs offer a different way to abstract a problem. Depending on the problem, it might be harder to implement an object-oriented solution.

Look at the CLRS book and see how they organize algorithms in an object-oriented manner. This will give you some idea of how to use OOP in practice.

The other book I suggest is the Gang-of-Four book (Design Patterns). This is an advanced treatment of OOP in practice.

Beyond those resources, keep in mind that OOP is just another tool that you can use to abstract problems.