Thoughts on OOP.
Note: This is written as part of a letter in response to a good friend who asked for my opinion on OOP. This is mostly an off the cuff work in progress:
What a question to try and tackle. I have so much that I want to say but I am going to try and distill my thinking to what I believe are the most relevant points. This might get long because I'm going to use this as a recap of my own understanding on the topic as well
Mutable State
By far the most dangerous thing about OOP is the use of mutable state. You've probably noticed in your programming career, especially making the jump to the front-end that mutable state makes everything harder. Every guarantee breaks down. When you have some object with a mutable API, and multiple things holding a reference to that object or it's state, there's no good way to coordinate updates to that object without breaking consumers, especially in a multi-threaded context.