Object-oriented design is about message-passing; messages are more important than objects. Classes are completely irrelevant – there’s an entire branch of object-oriented language design without classes!
Comment on Functional Programming vs. Object Oriented Programming
abhibeckert@lemmy.world 9 months ago
I fundamentally disagree with the idea that these are competing strategies.
Just like walking doesn’t really compete, like at all, with Flying in an Airbus A380, Functional and OOP are at their best when you use both of them throughout your code.
Corbin@programming.dev 9 months ago
abhibeckert@lemmy.world 9 months ago
there’s an entire branch of object-oriented language design without classes!
That’s not OOP anymore.
I’d argue “message passing” is an implementation detail rather than part of OOP. And it’s an implementation detail that is rarely used in modern OOP languages.
Redkey@programming.dev 9 months ago
Whatever it may have become in later years, Alan Kay, who is often called “The Father of Object-oriented Programming”, outlined the message-passing idea as the main concept he was driving at, originally.
He also says that he probably misnamed it.
Here’s a discussion in which the man himself makes a (small) appearance: …stackexchange.com/…/so-what-did-alan-kay-really-…
xigoi@lemmy.sdf.org 9 months ago
JavaScript is an example of how OOP can be done without classes (before they were added to appease Java enthusiasts).
dneaves@lemmy.world 9 months ago
Also, I take issue with the claim that OOP is all about “objects”. It’s also about classes.
Depending on the language, classes are just objects too. So its still just about objects.
Pipoca@lemmy.world 9 months ago
Just like walking doesn’t really compete, like at all, with flying in an aircraft, Functional and Object Oriented Programming are at their best when you use whichever approach makes sense for a given situation and in any reasonably complex software that means your code should be full of both.
I’m not really sure sure that’s true.
In FP languages like Haskell, you get tools like algebraic data types, typeclasses, and pattern matching.
FP is really opposed to imperative programming, while objects are opposed to algebraic data types.
You can write OO code that’s 100% fully functional, and you can write code in Haskell where you barely notice you never once used an object.
bungle_in_the_jungle@lemmy.world 9 months ago
The older I get, the more “it depends”.
Gallardo994@sh.itjust.works 9 months ago
This. Nothing is a silver bullet.
Grtz78@feddit.de 9 months ago
Not even silver bullets.