DEV Community

Cover image for What Clean Means and Why you Should Care 🧹
Jessica Veit
Jessica Veit

Posted on • Updated on

What Clean Means and Why you Should Care 🧹

Clean is a term that gets thrown around in the software development industry like null pointer exceptions. We read and hear everything about clean code(r), clean architecture and whatever other stuff that may or may not be clean in one way or another. Even project managers love to pick on us developers while rambling about the importance of this topic, often not being equipped with any coding experience or knowledge about it whatsoever.

So, it seems that over time many developers got desensitized to truly caring about these concepts which were meant to give structure and a sense of ease in our craftsmanship software development. Now let us take a step back together. Forget about the times this simple, silly word nearly made you lose your marbles and look at what it can truly do for us.

The main Benefits of Clean

As with everything a good amount of motivation makes things a lot easier. The main benefits of working clean are pretty obvious if you thought about it once.

  • Easier to Test (more spaghetti for your dinner plate)
  • Bugs are (more) obvious (again less spaghetti chaos in your code and problems sometimes just kind of resolve themselves)
  • Lower maintenance burden (because there are less bugs to fix and customers to calm down)
  • Less communication between developers needed (communication is key but let us use that time for more important topics)

And the list goes on. But you may already see a trend going in the direction of “If you do it right, you only have to do it once.”

Clean Code – everyone starts small

The devil is in the detail, so first focus on that one. Thinking of the actual essence of software brings us to the code itself. But let us not dive into classes just yet, what are characteristics your ideal code should have? What special kind of spice was in the last snippet you really liked just because of how it looked? Probably at least one of those features grabbed your attention:

  • The code was documented, but not polluted by comments
  • Names of variables and function seemed reasonable (not too long and not too short)
  • The code was not nested in some (nasty) way
  • Functions (if present) fit on your screen (without zooming out)
  • Calls were not overflowing with parameters

Did you see your snippet? All these rather small things make a difference concerning the general appearance of your code. And guess what, with just those thoughts in mind, your code base will already make a huge step in the right direction.

Clean, simple, and smart.


Ps. I highly recommend all books written by Robert C. Martin if you are interested in cleaner code and a simpler developer life.

Top comments (5)

Collapse
 
ksaaskil profile image
Kimmo Sääskilahti

Thanks for the good post! I'd also like to recommend the Pragmatic Programmer 20th Anniversary Edition, I think it's more modern than Clean Code in many ways. Especially when it comes to code examples. Of course, the basic principles of Clean Code stand 🙂

Collapse
 
jessica_veit profile image
Jessica Veit

Thank you for your nice comment! I will definitely check it out :)

Collapse
 
rxliuli profile image
rxliuli

If you like clean, then you can try JetBrains IDE, the built-in linter is incredibly powerful

Collapse
 
sturpin profile image
Sergio Turpín

You're very right, good post! ;)

Collapse
 
funkymuse profile image
FunkyMuse

Beautifully written