Functional Programming - Scala
During the weekend, I manage to dig a little bit more about Functional Programming and I summary here some useful links for those who might want to know about this programming methodology
Firstly, I found this link is a good introduction: https://www.youtube.com/watch?v=KOjC3RhwKU4
The above presentation is very informative and it provides some intuitive comparison between the imperative (e.g: mostly OOP) vs reactive programming (i.e: FP). From his talk, he introduced another way of doing "the" things.
Secondly, I would like to share some other aspects that I had discovered. I would not convince anyone about which one (OOP or FP) is better than the other.
For FP, it would be tricky when you deal with "Lifting", also, a lot of functions/features are implemented with the recursive mindset.
My 2 cents: Working with a function of Scala is like you are working with a mathematics problem, and trying to describe a mapping function from "Set" A to "Set" B. Please correct me if I'm wrong.
Another 2 cents (add-up to 4 cents) is that: there are many predefined functions (utilities) pre-made within the language itself (also in the form of libraries). And the more you know the detail of them, the better for you to work as FP developer. And there are countless of them.
Also, this is worth reading: https://softwareengineering.stackexchange.com/questions/9006/whats-your-strongest-opinion-against-functional-programming
Moreover, this is how Quicksort could be implemented in FP: https://www.quora.com/What-is-the-dark-side-of-functional-programming-What-problems-are-not-suited-for-functional-programming-What-problems-arise-in-large-deployments
Thirdly, when dealing with SQL database (ie ORM in Java world), then you'll have the moments like this: https://www.reddit.com/r/scala/comments/4enaw4/i_cant_grasp_slick_3/
Finally, there are a lot of terminologies specifically for FP that you need to comprehend in order to fully grasp the skill to work with it:
e.g:
Recommended by LinkedIn
partially applied function
debounce
function chaining/function composition
yield
anonymous function
a lot of new symbols: e.g: _ , => , ??? , Arrow -> , Generator <- , _@ , Type ( [+A][-A][+S,-T] ) , Bounds (A >: B, A <: B, A <% B, A : B =:=, <:<, <%< ) , etc.
Ambiguous implicit values
trait, case class
Specifically, for Scala:
Scala also has a concept of datatype which Java does not have, i.e: Symbol
When working with Scala, we have to deal with Algebraic Data Types, and Pattern Matching a lot.
Need to learn "Category Theory" in order to fully unlock your ability with Scala. I had begun to study about Category Theory which begun with this question: https://stackoverflow.com/questions/58515409/scala-function-map-is-a-pattern-matching-or-an-interation