+ 3
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?
5 Answers
+ 3
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.
+ 2
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.
0
Yes Dragonxiv , So they can be used interchangably on a project? but which circumstances would you use one over the other, any valid examples?
0
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.
0
Dragonxiv recommend for what?, how does this relate to oop and fp?