I started re-learning how to code and decided to learn OO for the first time. After reviewing several languages, I chose Python then almost immediately was introduced by @paulspencerwilliams to Clojure and immutability. I've now done just enough OO and functional to be equally confused by both, so I wrote this: https://andywootton.wordpress.com/2016/07/25/objects-vs-functions/
I wanted to know more so asked a question on the birminghamfpmeetup Slack channel: "I see an OO system as a network of objects, each representing real-world objects as data structures and methods, plus some other objects, invented to make things work. What does a functional system look like? Is there any reason objects can't be built out of function calls rather than method calls and with local or shared data structures?"
Paul answered, saying "objects are possible in FP languages. There's
a good example in Joy Of Clojure. Also, look at Stuart Sierra's
component library. Other FP systems may have a single state store
(clojure atom, db etc) that side effecting functions update explicitly,
but generally, all renditions of this central state is immutable."
I asked, "Do you see state/mutability as an essential part of OO?"
Paul said "state yes, not necessarily mutable, but OO by definition is the complecting of state and behaviour."
I haven't ever thought about OO in terms of state so this was new to me. I looked for an alternative definition and found this http://searchsoa.techtarget.com/definition/object-oriented-programming
'(OOP) is a programming language model organized around objects rather than "actions" and data rather than logic. Historically, a program has been viewed as a logical procedure that takes input data, processes it, and produces output data. The programming challenge was seen as how to write the logic, not how to define the data. Object-oriented programming takes the view that what we really care about are the objects we want to manipulate rather than
the logic required to manipulate them.' That could be a definition of functional as well as procedural.
It goes on to say 'The first step in OOP is to identify all the objects the programmer wants to manipulate and how they relate to each other, an exercise often known as data modeling.' This was a surprise too because I remember doing data modelling for a FORTRAN project before I'd ever heard of OO. If you worked in COBOL, it was called it "Data Processing".
This discussion seemed to have broken free of the functional paradigm, so I said I'd move it here. I'd like to know what OO people think differentiates Objects from procedural. I think it's that procedures and data are clustered around objects instead of being in a big lump. I think this is what makes using relational databases for object persistence such a problem for OO languages.