Clean Code – Brief Review
June 26, 2019
Currently, I find my self reading Clean Code by Robert Cecil Martin, and just completed the first three chapters. I am taking my time to digest the genius work of Robert, and I see it as a need to share what could be understood in just the first 50 pages of the book.
To Robert, spending time to write the right code is an investment in the future maintenance time of that code. You can probably relate how a poorly written code has made you brainstorm for hours if not days before you could make that simple one-line change.
While some people see it as moving really fast and not paying the necessary attention to their codes, he mentioned how writing good code is like writing a novel. The flows, structure, and content arrangement should be perfectly laid out to make the reader not need a second glance before comprehending the information the writer is passing.
In his book, Robert stated a conundrum: “All developers with more than a few years of experience know that previous messes slow them down. And yet, all developers feel the pressure to make messes in order to meet deadlines.” Which he further agree to that true professionals the second part of the conundrum is actually wrong, as a saying goes no amount of wrongs can make a right.
If you have been in the freelance space, you probably must have experienced the second part of the above conundrum. We tie productivity to shipping in the least possible time, and not considering that the time we did not pay to think through writing good codes would be demanded the next time we visit them again.
You know you are working on clean code when each routine you read turns out to be pretty much what you expected. You can call it beautiful code when the code also makes it look like the language was made for the problem: Ward Cunningham
Codes should be pretty straight forward and do what they state, you nod at good code when you read them from the first glance. Part of our responsibility is to make the language look simple. With Ward’s statement, it is not the language that makes programs look simple. It is actually the programmer that make the language appear simple!
To Robert, the ratio of time spent to write new code to the time spent reading old codes is 10:1. Experienced programmers can tell how much they have gone back and forth writing, deleting and commenting out codes in an effort to write a new one.
It takes constant practice to write good codes, it does not have to happen from the very first time of writing the codes. It could come after the code has been completed in an optimization process, the goal is not to leave a messy campground.
Chapter Three of the book commence the lesson on writing good codes, beginning with tips for writing a good function. There is a wealth of knowledge buried in this chapter, I will be sharing my thoughts and understanding about this some other time.
We are authors, and one thing about authors is that they have readers. Indeed, authors are responsible for communicating well with their readers, the next time you write a line of code, remember you are an author, writing for readers who will judge your effort. - Robert Cecil Martin
Be an artist, draw beautifully. Be a writer, write understandably. Be a poet, write eloquently. Be a programmer, write good codes.
Edit on githubTweet