May 15th, 2011, 11:47 am
Any remarks on deep C++ inheritance hierarchies? (let's say 6 levels deep and of course the Publisher-Subscriber at the root). A developer's nightmare. I push the idea of visual determinacy AKA being able to tell what the code is going to do from what is on the screen, without having to page around and search too much.This thread started off on performance, and I have fouind there is a strong correlation between code that's easy to understand and how fast it goes.To some people that's not intuitive because we've all written something nasty that went quick.However when optimising code one has a finite budget of programmer time, and the longer you have to spend trying to work out what the code does, the less time you will have to make it go faster.Also since deep inheritence often has the purpose of hiding lower level detail it follows that you may easily miss serious optimisations.That's one reason why multiple inheritence may be a superior choice, since some teams code excessively deep hierachies because they want to remain singly inherited because some fuckwit coding standard (or manager) says they must. That's one reason I prefer C++ over Javan and C#Note I say may be a superior choice, when you pay me to code, you pay me to make good decisions about how I do it.I may decide that MI does the job, or I may not, but that choice needs to be mine.