Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
tilde31437yI cannot think of any reason why functional programming would be better. Maybe for simple stuff. Most real-world applications demand OOP. It would be extremely difficult to implement without good OO modelling.
-
Root797797yFunctional programming makes threading extremely easy, and therefore scales horizontally very very well.
Most oop apps only scale well vertically, which gets expensive quickly! -
ac123511437yit often is more solution oriented.
Where in OO you do a lot of designing a hierarchy, you don't do that in FP.
It is simpler and often more predictable. -
Pure functions* are very easy to test and debug. They are predicable and can be composed with one another.
*Pure functions that have no side effects, for every input that is the same, the same output is provided. For example: a function that adds two numbers -
Neither is the holy grail. Functional programming is mostly from JS guys.
And OO is rather new in that regard.
Some languages are OO only and some functional only and some mix.
I prefer a mix from both but honestly functional programming gets messy as fuck after some time mostly because stuff gets implemented dozen of times and they all have different behavior if you don't go strictly with your code guidelines. Look at php for example many function somenamed so or some_so. Haystack and needle for string functions aren't consisting either foo($haystack, $needle) and bar ($needle, $haystack). I still like php though because it matured.
On the otherhand I made a little adventure into Java and could scream when I had to write stuff like
Url url = new Url("http://foo.com"); and that motherfucker wanted me to catch an MalformedUrlException.
choose your poison but don't say any is better
PS: JavaScript is a clusterfuck because most node_modules are missing core functionality -
c2wiki3777yhttp://weblog.raganwald.com/2007/...
For examples see CommonLisp, Haskell, Elixir...
Oh and http://smashcompany.com/technology/... . -
@Data-Bound you're probably right. I have a distaste against OOP because industry treats it as the defacto methodology. Fortunately they are slowly coming around and frameworks like React are becoming more mainstream thanks to Facebook. Even if they have a stupid license agreement.
I have lately seen a lot of people mentioning that functional programming is better than object oriented programming.
So far I have only experience in oop and I would really like to know some reasons why it is better.
undefined
marked as too broad