Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've done plenty of maintenance programming. Most OO involves abuse of the paradigm anyway.

Most people don't use inheritance to large AND good effect. Or they use it and create a mess. Deep hierarchies of inheritance need to be carefully designed or they become a mess. All the hiding means less clarity about what is happening when things go wrong.

That said, its a valid approach and can yield useful results. Especially when you can just add a thing to a list and simply call a method on it without having to bother to know what it is.



>Deep hierarchies of inheritance need to be carefully designed or they become a mess.

Deep hierarchies of anything need to be carefully designed.


The flip side of my impromptu "rule" is that you can drop the "careful" part as long as you are comfortable with a little or a lot of mess. Obvious common sense lowers the tolerance. I wonder how others set their tolerance? My perspective is that most OO hoerarchies don't go too deep. I've seen 4-5 at rare extremes. Around 2-3 is common. I'm sure someone has encountered 10 or more. I shudder to think how well that turns out in practice.


I try to use the rule of after three levels of inheritance or abstraction then it needs to be a black box and then you can reset your count.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: