Dependency Injection Breaks Encapsulation

No, I shouldn’t need to read the documentation to determine if your “Default Table” class is dealing with database or HTML tables. It should be able to meet that baseline of clarity from naming conventions and comments alone - that is it should be able to self document itself at least to that standard. If it can’t something is wrong

Can you even tell me all of what that class does in 20 words or less? Just from glancing at the declared variables I doubt it. If you can’t give a concise description of what the class does then the class is itself inconcise and should be broken apart into two (or likely more) related classes.

I’m not trying to be mean here, but I’ve seen old code bases that have been home grown over a decade without ever being pruned and been paid to work on them. I don’t think you’re stupid, but I don’t think you’re any smarter than the guys who wrote those programs either and they where replete with gotcha’s and minefields typical of the ball of mud pattern that made doing anything more than slightly outside the program’s main purpose a nightmare. And if having, what, 50+ public variables on one “default” class object isn’t a ball of mud then nothing is.

3 Likes