On Tuesday, 28 August 2018 at 23:27:09 UTC, Nick Sabalausky wrote:
On Tuesday, 28 August 2018 at 21:57:28 UTC, solidstate1991
wrote:
Thanks to my education, I first wanted to approach every
problems in programming from an object-oriented viewpoint,
since that was the only one we were taught.
Sounds like you were more or less lucky compared to average:
For a long while, OOP wasn't just the only thing taught, it was
frequent taught specifically to be "the one and only right way."
It's not so much OOP itself that's hated: It's the late 90's
early 2000's obsession that OOP is the one right way to do
EVERYTHING that gets a lot of (much deserved) hate.
I used to do a lot of OO myself (in fact, Tango was very
heavily rooted in OOP design), but the more I use D2 and other
things, the more convinced I am that there are just simply
better mechanisms (provided the language in question supports
them well enough) to get the benefits offered by traditional
inheritance-based OOP, without so much of the now-well-known
downsides. I'm 90% convinced that an equivalent of traditional
Java-style OOP could be constructed out of these meachanisms
without too much trouble, and is effectively a subset of them.
If I were a grad student, I would totally do a thesis around
that.
Honestly C++ did OOP somewhat right, because it wasn't forced
upon you, but C++ itself has design issues, that I think D has
solved very well.
D does OOP better than C++, but D is still missing some very
common OOP patterns.
See:
https://forum.dlang.org/thread/tjqxslxfxjgliyziz...@forum.dlang.org
In C#, Java etc. that's a perfectly common pattern. I don't know
what C++'s behavior is, but I guess it doesn't matter in C++,
because of friends.