Post

One simple programming lesson I'd LOVE to help new programmers get right: Stop using inheritance for everything. I don't know what it is, but I feel like it has to be something about how educational content is structured by either: - The formal education system - and/or online learning platforms

2 reposts3 likes

... but anecdotally, I have continued to see inheritance get completely overused when developing software. I'm also speaking about this because *I* was a huge offender of this early in my career. I wrote absurd amounts of code that completely abused inheritance.

Why the heck do you think I have an entire course on refactoring?! My hunch, and I don't want to upset too many people (just a few), is the following: - People start learning to code - They eventually come across Dont Repeat Yourself (DRY)

- They start to see patterns in their code and start over-using DRY because if it looks remotely similar, we might as well refactor it to a common spot! - These developers start learning OOP principles

- Inheritance is the one that sticks because we always talk about memorable things like how a car is a vehicle and a cat and dog are animals - People suck at creating composition examples I guess, so nobody remembers to use it??? (The jury is still out on this)