Vlad's Roam Garden

Powered by 🌱Roam Garden

bad code kindles the urge to write comments

When we see that we've created something confusing - we often have an urge to add explanations around it. But a far better approach would be to refactor the code, so it won't be confusing anymore.

One of the more common motivations for writing code/comments is bad code. We write a module and we know it is confusing and disorganized. We know it’s a mess. So we say to ourselves, “Ooh, I’d better comment that!” No! You’d better clean it! Clear and expressive code with few comments is far superior to cluttered and complex code with lots of comments. Rather than spend your time writing the comments that explain the mess you’ve made, spend it cleaning that mess.