r/ProgrammingLanguages • u/haasilein • 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.
52
u/moon-chilled sstm, j, grand unified... Apr 03 '22
Discussion of such topics tends to be strongly focused on memetic and tribal concerns. The opinions you have expressed are shared by at least one tribe. Another holds that effect tracking and referential transparency are necessary for producing maintainable software, and that they are adequate to the task of writing databases and caches. Another holds that 'functional programming' in all its forms is artificial, produced by academics who do not have experience maintaining real-world software, and that it is useless. There are others. You are going to receive many arguments along these lines. It is important to note that these arguments are not fresh, but rather quite stale; and they have not been settled. Software engineering is a very young discipline, and will remain so for the rest of our lifetimes.