DEV Community

Discussion on: How has your opinion on "clean code" changed throughout your career?

Collapse
 
cjbrooks12 profile image
Casey Brooks • Edited

I've found that you can't really start out trying to make code clean. There are simply too many unknowns, too many variables at the beginning of a project to be able to start out clean. No matter how many "good abstractions" and "clean patterns" you put in place, things will start to get muddled and messy over time.

Thus, what makes code clean is going back after a while, looking at what's messy and deciding then what you actually need to do to make the code maintainable. Code doesn't start out clean. Cleaning it up makes it clean.

Collapse
 
kendalmintcode profile image
Rob Kendal {{☕}}

This ^^^ absolutely.

You start with the best intentions but you're absolutely right, there are too many directions to choose, unknowns, etc. and you end up chopping about to get to where you want to be and to actually get something built.

I wrote an article on this a while back, namely continuous refactoring, which helps as you go.