Chapter 1 — Clean Code

There will be code.

dilrajio
3 min readMar 3, 2020

It is crazy to assume that code will one day become obsolete. Code represents the details of the requirements… details which must be specified explicitly via a machine that can execute them. A skill also known as programming. What people really mean when they say “it should just code automatically it for me” — is that they want an outcome to do what they want; not what they say.

Bad Code:

Wading (v): Being significantly impeded by bad code.

If you are like me, you may have been impeded by bad code at some point in your software career. If you are really like me, then it may have even been your own bad code.

Why did you write this code?

  • Perhaps you were in a rush
  • You felt pressured by project managers to get it done sooner than later
  • Need to push it fast, but you intended to clean it “later”
  • There were “better” and “more meaningful tasks” in the backlog

I am sure there was a good reason for why the code was written, but I want to draw out how this habit will overtime drain productivity.

To illustrate, imagine that the codebase has been neglected to such a measure… the engineers know it, management knows. So, the only thing left to do is to setup a new team to rebuild the damn codebase in a clean manner.

It may look something like this.. Definitely not something you would want to experience more than once.

Though I have not seen this personally, software veterans have seen this race last over a decade.

Clean code is not just about time management or productivity. it’s a matter of peofessional survival. — (Martin 1.3)

Who To Blame?

The consequences of owning this total mess cannot be shifted to the managers, scrum masters or project owners… We can make numerous compelling arguments about how we were rushed into a delivering a project… but can we really?

One thing I am personally bad at doing, is saying “no.” This mental framework is also responsible for polluting a lot of code because the team was continuously accepting and rushing through “quick” projects.

As crafters of software, it is our responsibility to defend our software and the contents within it; the same way, a manager will defend their schedule from interruptions and/or unexpected meetings.

Words From Some OG’s

Uncle Bob was able to ask some of the most prolific and well known developers the golden question:

What is clean code?

I highly recommend you read the full epilogues, but here is my personal favourite from Michael Feathers.

Michael Feathers. Author of ‘Working Effectively With Legacy Code’ — Artwork By Jeniffer Kohnke

“Clean code always looks like it was written by someone who cares.”

The Boy Scout Rule

Here is one important lesson that you can start applying immediately. If you see some inefficient or hard to read code along the way when programming… just clean it up. A ticket does not need to opened and you’ve also now made the codebase cleaner then it was yesterday.

--

--

dilrajio

ੴ | Software Developer | building for beauty and accessibility. Looking for opportunities in Seattle.