DEV Community

Tony Colston
Tony Colston

Posted on

clean code is over rated

I read this article:

I have a tendency to write dirty/ugly code almost always. I tend to go for simple stupid. Mainly with the thought that I will need to work on it at 2:00 am after no sleep.

There is a spot where cleaning up code makes sense. Usually if I have some number (2 or more) of the same code I start looking to bring it together. Even then it is a judgement call.

Sometimes it is pain based development. Does having 2 copies of this code cause me pain? Or have I put bugs in PROD because of the duplication? Then I should look to simplify the code.

One other thing from the article that you can learn is always talk to a maintainer if you are removing duplicated code. There might be reasons it is there. They may love your changes too. Be polite and ask.

Top comments (2)

stevenavelino24 profile image
Steven Avelino

Sure you can write dirty code. Duplicating pieces, not writing comments or tests or simply not optimising what you're producing.

But ultimately, you'll hate yourself, or will be hated by someone else for doing that when you'll have to go back to the projects where you didn't code well because you were lazy while coding it.
Do we all code dirty and bad code ? Yes, all of us, we're not perfect. Am I proud when I do ? Not at all. I didn't learn things for years to make the exact same code I could have produced years ago.

francofadini profile image

The writer is far from clean code concept understanding. It’s really needed.