Object Oriented vs Functional Javascript | Sololearn: Learn to code for FREE!


Object Oriented vs Functional Javascript

Objected oriented programming is bulky, has side effects etc. Functional programming is clean, doesn’t have side effects etc But when should you use one and not the other? Are there circumstances where you’d use both?

4/27/2019 10:05:01 PM

Logomonic Learning

5 Answers

New Answer


Most modern languages are OO with a bit of functional thrown in, so you will usually be using both at the same time. OO: classes, objects, ... FP: lambdas, higher-order functions (.map, .reduce, ...), ... Functional code can have side effects I think, just the language that I keep on rambling about in this forum doesn't have them, and a few others. There is the so-called "expression problem" that discusses which types of problems functional can do well, and which code OOP can do well. But there are solutions to the problem in most languages. It is worth checking out though.


From my experience i see more functional languages in science and more object oriented langiages in the software industry. But you can both both ways. It completly depends on what you wanna create and what languages you know.


Yes Dragonxiv , So they can be used interchangably on a project? but which circumstances would you use one over the other, any valid examples?


If you wanna create your own game engine i would choose c++. C++ has the benefit of having nice access to both directX and opengl. Also there is a big community out there doing the same so you have many resources to learn from. So in this example i can pinpoint a single language which i would recommand.


Dragonxiv recommend for what?, how does this relate to oop and fp?