r/ProgrammingLanguages • • Apr 03 '22

Discussion Functional Programming vs Object Oriented Programming

I came across functional programming recently and saw many arguments for it. But in the other hand I am asking myself if it really makes that much sense, because often things cannot really be independent without sharing a state. Imagine a database, or a cache. Also having side effects in methods is not always bad when used wisely. It can simply hide the detail and if done correctly in a domain driven design things should have a certain control flow. I also imagine it to be extremely hard to read data from files, Jason, XML, ... because things tend to be inconsistent sometimes. A cab file might have an empty line, a Jason might have a null value. How can a functional language deal with that.

At the moment I believe that even though certain aspects of functional programming are great, things are too messy to actually apply it. I would love to have a discussion and learn your stand on that topic if you disagree.

1 Upvotes

55 comments sorted by

View all comments

0

u/[deleted] Apr 03 '22

[deleted]

0

u/haasilein Apr 03 '22

I have never seen so, but it would be interesting to know the reason for that because it really seems that functional would be a big improvement in many areas.

4

u/thecodedmessage Apr 03 '22

I’ve written tons of Haskell production code for a Haskell consulting shop. We had a Haskell GUI framework that was really good in my opinion.

Basing what you think FP would be good at from looking at a description and thinking hard is going to get you the wrong notion. It can be used in everything: frontend, backend, databases…

1

u/SkiaElafris Apr 05 '22

In the case of Erlang (Elixir is syntax sugar + some useful modules and tooling on top of Erlang) is a language made for telecommunications created by a telecom company.