by jcelerier · 7y ago · 0 comments
Really depends on what is your definition of "OOP" here
> Both Smalltalk and Erlang make use of OOP the way it was originally intended by its inventor, Alan Kay.
ah, the bad definition of OOP then.
Hint : most C apis that look like
foo* foo_create(void);
int foo_get_bananas(foo*);
void foo_print(foo*, int, int);
void foo_free(foo**);
are OOP, not procedural. They just lack the syntax sugar.> Linus Torvalds is widely known for his open criticism of C++ and OOP.
yet he went on doing C++ for user-space code : https://www.youtube.com/watch?v=ON0A1dsQOV0
> Some might disagree with me, but the truth is that modern OOP has never been properly designed. It never came out of a proper research institution
as someone who did a phd in a "proper research institution", that's a completely bullshit criterion.
> OOP doesn’t have decades of rigorous scientific research to back it up
oh come on
I smell a no-true-scotsman incoming..
>> Both Smalltalk and Erlang make use of OOP the way it was originally intended by its inventor, Alan Kay.
> ah, the bad definition of OOP then.
Message-based OOP is usually considered to be superior to inheritance by even OOP advocates, and even composition-based OOP by many. I don't see your evidence for "bad definition of OOP".
>Hint : most C apis that look like
> foo* foo_create(void);
> int foo_get_bananas(foo);
> void foo_print(foo
, int, int);> void foo_free(foo);
>
> are OOP, not procedural. They just lack the syntax sugar.
Not every API that uses a struct is OOP. If your foos use inheritance, virtual dispatch etc, then yes it's OOP. But usually it's just something like a struct to store state instead of having globals or multiple parameters even.
>> Linus Torvalds is widely known for his open criticism of C++ and OOP.
> yet he went on doing C++ for user-space code : https://www.youtube.com/watch?v=ON0A1dsQOV0
He's a pragmatist first and foremost, and the GUI libraries he uses (Qt) and the programmers that work on GUI code use C++, he said. I doubt he would write his own GUI framework in C++.
ADT's/"Object-based" programming (which is what you show above) is not the issue. The biggest problems occur when you introduce non-trivial inheritance/polymorphism.