Recently I started learning FP paradigm. I am finding difficult to grasp the concept, probably because I being from OO back ground. While recently watching below famous talks by Rich Hickey (founder of clojure language), he seems to be hinting the benefits of FP by comparing how we program in OO world (which he says place oriented programming).
Key takeaway and outline from these talks IMHO is :
OO is missing time dimension….Identity is separate from state….State is value of identity at any given point of time……Identity is succession of states….So, Identity is not a state but rather it has a state….Place oriented programming paradigm violates these principles…Basically the concept of erasing and overwriting memory cells (mutating object) itself is not correct.
I really feel convinced with his thought process and specially missing time dimension part (because state of object is its value at given point of time). But unfortunately I still could not visualize what is wrong with this programming model in OO. It would be great if someone can help me understanding this with some examples. What we would had gained had we created history of states rather than mutating state itself ? Is it because of this programming model – OO programmers often need to fallback upon imperative coding style by capturing values in some variables (I mean in order to do any logic you need to take snap shot of application’s previous state) ? And this capturing of intermediate state is what makes it difficult in imperative world when compared against FP ?
To me it appears that as per him definition of identity is much more deeper rather than thinking of two variables having same identity if they reference same objects (which looks more like referential identity)
I think I understand benefit of immutability and technically how it helps in multi-threading situation by avoiding writable share resources. Somehow I feel I need to address above doubts in order to understand core notion of FP.
Also, this is my first query in F# community - If it does not feel right place for above question, please point me to more appropriate forum.