Notion of place oriented programming in OO vs Programming with values and expression in FP

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).

[Value of Values]

[Value-Identity-State]

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.

1 Like

It sounds a lot like he is describing the same benefits of having an Event Sourcing system… or maybe that’s just how I’m reading it :slight_smile:

3 Likes

Since you came here it seems you have an interest in F#. I’d say you should read some intros to F# instead of Clojure. For example, you can start here: https://fsharpforfunandprofit.com/posts/why-use-fsharp-intro/

Also I’d say you need not worry about time dimension. Obviously Rich Hickey is a key figure in FP “community”, and I’m not (although I do have eventsourcing experience), but I don’t see why you should start by worrying about time dimension. There are many benefits of FP compared to OO which you’ll soon see if you start with F# For Fun and Profit.