Its the best/worst thing about OOP no matter what language.
We had a rule at work that if you are 3 levels or more down an inheritance tree, then you are too far. The cognitive load is just too much, plus everything stops making sense.
One level can be great (MVC all have great conventions, MCP as well). Two can be pushing it (Strategy pattern when you have physical devices and cant be connected all the time, Certain kinds of business logic that repeat hundreds of times, etc…) But even there you are kinda pushing it.
I need code that I can look at a month from now and know WTF is happening. And sometimes its better to have less DRY and more comprehension. Or maybe im just a forever mediocre dev and dont see the “light”. I dunno.
This is exactly how I feel too. A little bit of repetition is totally worth it, versus having inappropriate coupling, or code that jumps in and out of parent/child classes everywhere so you can hardly keep it in your head what’s going on.
I freely accept that I AM a mediocre dev, but if that lends me to prefer code that is comprehensible and maintainable then I think being mediocre is doing my team a favour, honestly.
PTSD flashbacks to the codebase I started on in 2008 which had… I don’t even remember. Like six or seven levels. Fucking nightmare. I did a printout of the analysis Oxygen gave me and it ended up as a 4x3 meters poster ;_;
But if I have to make an Array I have to inherit from Indexable which inherits from Collection which inherits from Object! How else am I supposed to implement an Array?
I totally agree on this. I found that often things that appeared to need inheritance at first glance often didn’t if I gave deeper thought to it.
Granted I was working on much smaller projects rather than crazy huge multi team enterprise apps, but I’d guess that even then this is a good “rule of thumb”.
Cool, good to know someone else has the same experience.
Ive been on a couple of multi-year projects and they are NOT fun with OOP + developer went crazy with patterns they were experimenting at the time. Its what made the “rule” pop up to begin with.
Its the best/worst thing about OOP no matter what language.
We had a rule at work that if you are 3 levels or more down an inheritance tree, then you are too far. The cognitive load is just too much, plus everything stops making sense.
One level can be great (MVC all have great conventions, MCP as well). Two can be pushing it (Strategy pattern when you have physical devices and cant be connected all the time, Certain kinds of business logic that repeat hundreds of times, etc…) But even there you are kinda pushing it.
I need code that I can look at a month from now and know WTF is happening. And sometimes its better to have less DRY and more comprehension. Or maybe im just a forever mediocre dev and dont see the “light”. I dunno.
This is exactly how I feel too. A little bit of repetition is totally worth it, versus having inappropriate coupling, or code that jumps in and out of parent/child classes everywhere so you can hardly keep it in your head what’s going on.
I freely accept that I AM a mediocre dev, but if that lends me to prefer code that is comprehensible and maintainable then I think being mediocre is doing my team a favour, honestly.
@tiramichu
It’s this mentality that shows you aren’t mediocre. Simplicity requires more skill, not less.
@mesamunefire
Thats kind of you to say 😀
PTSD flashbacks to the codebase I started on in 2008 which had… I don’t even remember. Like six or seven levels. Fucking nightmare. I did a printout of the analysis Oxygen gave me and it ended up as a 4x3 meters poster ;_;
WTF
But if I have to make an Array I have to inherit from Indexable which inherits from Collection which inherits from Object! How else am I supposed to implement an Array?
I remember some crazy stuff back when I had to work with a Java + ember.js project. Everything was like that.
@mesamunefire
@tiramichu
I totally agree on this. I found that often things that appeared to need inheritance at first glance often didn’t if I gave deeper thought to it.
Granted I was working on much smaller projects rather than crazy huge multi team enterprise apps, but I’d guess that even then this is a good “rule of thumb”.
Cool, good to know someone else has the same experience.
Ive been on a couple of multi-year projects and they are NOT fun with OOP + developer went crazy with patterns they were experimenting at the time. Its what made the “rule” pop up to begin with.