By user12610707 on Mar 12, 2008
The first in my series of software development sins is confusion over complexity vs. value. More times than I can count I've run across a piece of code or a design that is just way more complicated than necessary. Sometimes this is simply a failure to apply the You Aren't Gonna Need It (YAGNI) principle. Sometimes it's simply someone falling into the sunk cost fallacy; after all, somebody put a lot effort into making something big and complicated, so it's natural they don't want to simplify it -- because that would mean throwing some of it away. Sometimes it's "hey, lookit all this code I wrote!" (even though most of it was cut-and-paste). Or sometimes it's just ego-driven: "Wow, look at this big complex system. Only a jock programmer like me could have possibly created it."
Certainly the above occur commonly enough, but I think there's something more fundamental going on. Complexity often results from a programmer's desire to deliver a more complete or more general solution to some problem. A more general solution is always better than a special-case one, right? This is often the case in something like, say, mathematics. The problem here is that software development is not mathematics: it's engineering. Usually a more general solution does provide some benefit. Often (though not always) a more complete or general solution is more complex. With complexity there are increased costs, not only of implementation, but understandability, maintenance, testing, documentation, support, and so forth. The latter include long-term, recurring costs, and they dominate the cost of initial implementation, yet they're what programmers think about the least when they're designing or implementing something. A decision to make something more complex might seem reasonable when only short-term costs are considered, but it can have long-term consequences that are hard to foresee. The question is whether the benefit of this additional generality outweighs the long-term costs of the complexity.
The engineering reality is that generality, and the complexity that often comes along with it, is just one of the forces acting on any solution in the design space. Remember this the next time you're tempted to make something more complex.