What is the deal with functional programming? I see talk about it a lot but to be honest I've never found them at all useful. Why do so many universities apparently teach them?
- Functional programming allows you to reason about problems differently
- Functional abstraction is very powerful and allows you to DRY up your code in ways not available to other paradigms
- In our multi-core future, functional languages may be easier to split into simultaneous tasks (though not-strictly-functional languages are working hard on the problem as well).
- It's easier to prove that programs written in pure functional languages (no side effects) are mathematically correct.
Functional Programming concepts build a foundation that will change the way you think and help you solve real world problems.
The concept is similar to why we all learn Multi-Variable Calculus, Algebra, and/or Engineering Physics as Computer Science majors, even though we may not ever need that specific knowledge in our careers.
This is why Law Schools love candidates with a B.S in Mathematics. Studying Mathematics teaches you to think about multiple concepts in a logical manner, and functional programming teaches you abstractions and many other important concepts that help you break down problems and look at them in a different light.
In summary, functional programming helps teach you how to learn.
When you are beginning, functional programming is the best thinking model. Because most of your programs will not require object-orientation. At least that's been my experience.
However, now that I get into some apps that require separation of display and logic, that's when I started to separate all the logic and display code, to make it easier for each do what it's best at.
But you won't know why to do that, unless you master Functional first. I never liked people shoving OO down on me, or that OO is the solution for everything. Just make sure that whatever approach you use, it makes sense for what you are working on, and isn't too steep a learning curve to take too much time away from the work you get paid to do.
Because it emphasizes verbs, not nouns. Sometimes it's the verbs that matter.
Because in general it uses less code to accomplish the same task. Less code to write, is less code to maintain. Besides being less code, it is also tends to have less state, and thus it is a little simpler to reason about (once you're used to it).
Maybe because universities want to teach something from all programming paradigms, and for certain things functional programming is better (like describing game characters movement and describing animations)