3 ms·
> Usually, the calls were via some abstract interface with a single implementor What's described here is over-generic code, instead of KISS and just keeping an
by badmintonbaseba 1y ago
> Usually, the calls were via some abstract interface with a single implementor
What's described here is over-generic code, instead of KISS and just keeping an eye on extensibility instead of generalizing ahead of time. This can happen in any paradigm.
- josephg 1y agoWe're all flavoured by our experience. You can for sure make a mess with flat C-style code that uses structs and global functions. But whenever I've seen a mess in C, its a sort of "lego on the floor" type of mess. Code is everywhere, but all the pieces are uniquely named and mostly self contained. Classes - and class hierarchies - really let you go to town. I've seen codebases that seem totally impossible to get your head around. The best is when you have 18 classes which all implicitly or explicitly depend on each other. In that case, just starting the program up requires an insane, fragile dance where lots of objects need to be initialized in just the perfect order, otherwise something hits a null pointer exception in its initialization code. You reorder two lines in a constructor somewhere and something on the other side of your codebase breaks, and you have no idea why. For some reason I've never seen anyone make that kind of mess just using composition. Maybe I just haven't been around long enough.