I’m currently working on an asp.net site, done by someone else, and it’s rediculously over complicated for what it does……Well I think so! Pretty much every class inherits from another class then another and another and so on and on……. You have to go about 8/10 levels on average to get the the base class, sometimes more! And these classes have other classes inside which follow the same pattern of Uber Inheritence.
This leaves me lost in code many many times resulting in God knows how many tabs open on visual studio.
Is this good/normal practice or is it bad practice? I feel it’s bad practice as something so simple is made over complicated with an over usage of inheritance resulting in un-extensible code……………but I could be wrong 🙂
Thanks!
Yes, over-using inheritance can lead to a spaghetti warehouse. Inheritance is a tool to allow for encapsulation and abstraction. Abusing it causes too much abstraction and then the purpose of the code becomes unusable. I’ve seen this pattern abused in imperative constructs as well where a method is passed from method to method to method before an action is actually applied.
It all works, but it’s just an exceptionally bad architecture for maintenance. I find this often occurs with consultants/contractors attempting to introduce complexity (re: job security).