Hacker News new | ask | show | jobs
by jackcviers3 5095 days ago
To me, ugly code is code that gets the work done but at the price of too much complexity ( non-DRY, non-cohesive, spaghetti, callback soup ), not enough abstraction, too much abstraction, or too few quality control measures (tests). These things make it difficult to maintain any code.

In other words, ugly code is code that must be rewritten to be maintained. Depending on the innate complexity of my problem that can be an acceptable trade-off.

Beautiful code should also be easy to maintain; usually that means making each layer of abstraction as simple as it can be, and adding a new layer of abstraction to handle additional complexity.

In this way, I may write more new code to handle newly discovered edge cases or new features, but at least I am not rewriting old code to solve the same old problems plus the new ones. That gets old really fast.