103 points · by DanieleProcida · 5y ago · 22 comments
manager: we need to design an admin system for a veterinary centre
dev: ok, this is it, remember your training
class Dog extends Animal {}
[1] https://twitter.com/iamdevloper/status/727854065426804738?s=...
One that I've always wanted to try is modeling an elevator bank: there's a surprising amount of complexity in the different states that an elevator can be in, as well as relevance to basic CS concepts (hierarchy, priority, capacity, &c).
A great extension to this would be the dedicated flash for the QL17.
What I try to convey to my students:
* We write programs to solve problems.
* The program is a model of the real-world problem.
* The better our model is, the easier it is to solve the problem.
* Objects are excellent ways to model real-world "things" and manipulate them in our programs.
I see online there's a movement that says OOP is "bad" but honestly in cases like this it makes perfect sense to me!
I found this talk by Rich Hickey very persuasive: https://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hi....
TLDR; bad code practices make bad code.
I think that this is confined to people who have a functional programming fetish, and those that worked at companies that drank the "OOP cool-aid" back in the late 90's early 2000's and built their codebase into massive, sprawling, strictly hierarchical monstrosities... I may have worked for one of these, and hated OOP with a passion till I realized that anything taken to an absurd degree is absurd.
If we all just orient our models in relationships that make sense for what they do, OOP is fine.
> till I realized that anything taken to an absurd degree is absurd
Whenever I see OOP taught, the expectation is that every non-primative is an object in a massive hierarchy. If the default is an absurd degree, what does that say?
I actually had a great professor who'd worked at Microsoft during the dark ages, and taught OOP with very sensible "this can get way out of control if you drink the cool-aid" warnings.
I also had a different professor that preached FP to an absurd degree, literally refusing to accept work that had a "too much OOP" flavor to it. Bad teaching and practices exist anywhere, hence my TLDR at the top.
All of these are real. I'm a professional photographer and I own this camera in my historical collection.
What's my point? Fuck OOP