DEV Community

Discussion on: Function vs Object

stereobooster profile image
stereobooster Author • Edited on

I plan this as a series of posts. At some point I want to write posts "What is OOP?" and "What is FP?". The problem with the definition of OOP is that there is no single right definition. I consider 3 main sources (which have equal rights): Simula (Ole-Johan Dahl, Kristen Nygaard), C++ (Bjarne Stroustrup), SmallTalk (Alan Kay).

I need some time to gather full picture, meantime you can consult with those sources:

Interpretation of OOP as The big idea is "messaging" is pretty close to the idea of actor model:

Sending a message to an actor is entirely free of side effects such as those in the message mechanisms of the current SMALL TALK machine of Alan Kay and the port mechanism of Krutat and Balzer.

— A Universal Modular ACTOR Formalism for Artificial Intelligence, Carl Hewitt et al.

jamesmh profile image
James Hickey

I like that first article you linked 👍

This stuck out to me:

This means that you can do things like send messages to objects written in different languages, transmit object definitions by mail, send messages via SMS, etc. In my opinion this is where a lot of the power of “message-passing” lies, but it’s also one of the least explored aspects.

I would agree that it's a messy topic. OOP gets a bad wrap for easily producing messy code. In my experience, using messaging patterns and isolating code properly can avoid this.

There is such a thing as messy and hard-to-understand FP code too 🙃
There is messy OOP code too.

There is well-structured FP. And well-structured OOP.

I enjoyed your article for pointing this out 👌