One Size Fits None

08/07/2025 << back to Debugging Myself

It’s likely that most people have seen one of those videos where a street vendor presents a clever multi-purpose garment. With a few twists, folds, and knots, it’s supposed to transform into a skirt, a dress, a scarf, a cape, a hood, a top, a mini dress… But none of the results are even remotely acceptable when compared to purpose-made clothing.

Let’s be honest — if it truly worked, there’d be no need to make more clothes.

The same thing happens in software. There’s a tendency toward premature optimization driven by an extreme fear of duplication. Many developers strive to build a single, all-encompassing solution. The Don't Repeat Yourself (DRY) principle has done a lot of damage due to how easily it can be misunderstood.

So, how is DRY misunderstood? By thinking that two things are the same simply because they look alike, behave similarly, or sit near each other in the codebase. A typical example appears in CMS-like applications, where users are handled via roles: same data model, same access logic, same permissions, same endpoints and storage. It’s a simple, easy-to-maintain pattern — as long as the application remains small in scope. But what happens when the app grows, and different user types start requiring divergent features?

The need for customization often leads to excessive complexity: added layers of configuration and degraded functionality. In the end, no user type gets a truly optimized experience.

When in doubt, the better approach is to start by duplicating and then abstracting commonalities as they emerge. Doing the opposite — splitting apart an over-abstracted solution into separate pieces later — is usually far more painful.

In software, as in clothing, fit matters more than flexibility.

exit(0);

<< back to Debugging Myself