News for hackers. Stuff that matters.
Re:Goodbye, shitty Car extends Vehicle object-orientation tu... by hinkley on Saturday October 19, 2019 @01:39PM (#21299664)
We spend so much time in college learning about tree structures that hash tables are almost an exception. Which is weird because I use hash tables every single day.

I also didn’t learn about the Liskov Substitution Principle in college or in my first few years in an OOP. Had to find it on my own and start teaching others. But I was in good company because Josh Bloch also didn’t understand it and a whole generation of devs aped his solutions.

People think of inheritance as additive but if you look at the code they write it’s often subtractive. Mammal is not a contract. Every fork in the tree is carving out more negative space than it adds.

Mammal is really a pretty terrible root. Some mammals are nocturnal. Some fly. One lays eggs. A few have no hair and we think hairy humans are gross. Some can hold their breath for hours and live four hundred years. Others measure life in days.

But not a single one is all of these things. If we talk about what mammals can do we include it all. But you can’t ask these things of most of them. You don’t even organize them by these traits (what’s in the tropical or night exhibit at a large zoo? Why are the seals and penguins together?)

Re:Goodbye, shitty Car extends Vehicle object-orientation tu... by postsantum on Saturday October 19, 2019 @03:51PM (#21300388)
Mammal interface is fine

interface Mammal { fun milk() }

Re:Goodbye, shitty Car extends Vehicle object-orientation tu... by hinkley on Saturday October 19, 2019 @04:11PM (#21300512)
I’m a mammal, Greg. Can you milk me?
Re:Goodbye, shitty Car extends Vehicle object-orientation tu... by postsantum on Saturday October 19, 2019 @04:30PM (#21300597)
Depends on your species, Steve

https://en.wikipedia.org/wiki/Male_lactation

Re:Goodbye, shitty Car extends Vehicle object-orientation tu... by danielg6 on Saturday October 19, 2019 @06:37PM (#21301168)
It was a quote from Meet the Parents lol.
Re:Goodbye, shitty Car extends Vehicle object-orientation tu... by hinkley on Saturday October 19, 2019 @08:57PM (#21301678)
A cromulent quote from a movie, where one character busts the chops of another character based on an eager classification error.