Hacker News new | ask | show | jobs
by loup-vaillant 9 days ago
A lot, yes, but far from most.

Most of the complexity I've seen in most programs I worked with so far was avoidable complexity, caused by under- and over-engineering. Mostly the latter.

If I had to identify the biggest culprit, that would be the OOP cult: all these organisation "principles" (not just SOLID) that have little basis in reality, and ultimately causes programs to be up to several times bigger, and up to several orders of magnitude slower, than the reasonable thing that just does the job.

The slower part is mostly because we forgot the laws of physics, ironically: the speed of light that ultimately drives the cache hierarchy for instance. That stuff is so fundamental by the way that even we humans have similar limitations with our working memory. The reason we split our source code in manageable, relatively isolated chunks, is very similar to the reason CPUs work faster when memory locality is good.

This parallel by the way may explain in part why simpler programs tends to run faster.

1 comments

The main purpose of OOP is not actually to make code simpler or easier to understand, it’s to make code more maintainable. I know that sounds like the same thing, but it’s not.

And, to be clear, I don’t think OOP is the best tool for that.

But, the idea of all these abstractions and de-coupling and dependency injection and whatnot is to make it easier to add code with less risk.

In small code bases this doesn’t matter. In multi-million like code bases, it does. Now you have to care about type gymnastics, interfaces, design patterns, factories, whatever the hell. Because otherwise everything is too everywhere, and small changes have cascading effects. Maybe that doesn’t sound too bad, but where it gets bad is when you can’t see those effects. Now every change is risky.