Live data from Hacker News

Goodbye, shitty Car extends Vehicle object-orientation tutorial (2011)

mail-archive.com

1–10 of 177 posts

Re: Goodbye, shitty Car extends Vehicle object-orientation tutorial (2011)

#4
I completely agree that "good design"/"bad design" depends on the problems we're trying to solve, rather than some abstract property of the entities involved (i.e. whether "Car" should extend "Vehicle" or not, and whether those classes should even exist, cannot be answered without knowing what we're trying to accomplish).

The suggestion of GUI widgets is certainly better and more concrete; although it's skating dangerously close to "Circle extends Ellipse" and "Square extends Rectangle" territory! (e.g. https://softwareengineering.stackexchange.com/questions/2381... )

Re: Goodbye, shitty Car extends Vehicle object-orientation tutorial (2011)

#5
I'm a game dev and usually program in C#. I love C# and honestly some features of OO (like objects and classes) are great for programming games.

But inheritance is just a shit feature imo. Situations where it would be beneficial are extremely rare. I generally just pretend it doesnt exist. There are much better alternatives to it for most situations (eg. composition, build a class from other smaller classes that do one thing)

Re: Goodbye, shitty Car extends Vehicle object-orientation tutorial (2011)

#6
> In good OO programming, we don’t make class hierarchies in order to satisfy our inner Linnaeus

I wish someone had told me this when I first started coding. I wasted so much time building pointless hierarchies based on ontology rather than DRY.

Re: Goodbye, shitty Car extends Vehicle object-orientation tutorial (2011)

#7
post #5

I'm a game dev and usually program in C#. I love C# and honestly some features of OO (like objects and classes) are great for programming games. But inheritance is just a shit feature imo. Situations where it would be beneficial are extremely rare . I generally just pretend it doesnt exist. There are much better alternatives to it for most situations (eg. composition, build a class from other smaller classes that do…

Inheritance is just a total mess. Overriding a method, especially a non-abstract one, feels more like monkeypatching. It feels unsafe, it's not clear if I should do it, etc. A lot of Apple APIs mark which methods should be overridden and which shouldn't be. It just generally feels like a crappy approach. Languages with deep inheritance trees like Ruby and Smalltalk and even Objective-C are also extremely difficult to learn how to use due to how much basic functionality of the object comes from far up the chain. Remember when Steve Jobs wanted people to make companies that just sell objects? Sounds like my worst nightmare. I don't see why Rust's dynamic traits, or just duck typing, aren't totally superior

Re: Goodbye, shitty Car extends Vehicle object-orientation tutorial (2011)

#8
post #5

I'm a game dev and usually program in C#. I love C# and honestly some features of OO (like objects and classes) are great for programming games. But inheritance is just a shit feature imo. Situations where it would be beneficial are extremely rare . I generally just pretend it doesnt exist. There are much better alternatives to it for most situations (eg. composition, build a class from other smaller classes that do…

Once you've ditched hierarchy, haven't you entered "functional programming" territory? It's just types, structs/maps/dictionaries, factories, and modules/closures now, right?

Re: Goodbye, shitty Car extends Vehicle object-orientation tutorial (2011)

#10

> In good OO programming, we don’t make class hierarchies in order to satisfy our inner Linnaeus I wish someone had told me this when I first started coding. I wasted so much time building pointless hierarchies based on ontology rather than DRY.

DRY is also not the goal.
Post reply on HN