Clean Code: Chapter 1

Cleanliness is next to Godliness.”

Today, despite the trepidation, a small smile broke over my lips when I saw the email.

The message was brief but exciting, heralding the official start of the Programmer’s Book Club!

I voiced my interest in the bookclub at the end of the Web Developers Meetup Group that I attended last Thursday (See A Sangha For Soun-Ja) and today I received my official invitation to join in.

The date is set.  Our inaugural meeting will be Thursday April 30th from 6pm -7pm.  Earlier, a vote was conducted to determine the book we will read.

The winner is: Clean Code by Robert Martin.  I have a pdf of the book already downloaded and ready to go.  According to the email, we are to have the first three chapters read and ready to discuss for our first meeting.

To help facilitate our discussion, a chatroom has been created so that we can communicate with each other even when we are not in person.

I am looking forward to sharing ideas and learning from real programmers.  This is an excellent opportunity for me to form the programming Sangha that I need to take my studies to the next level.

Then why the trepidation?

Well, I am a little apprehensive because I fear that I will not be able to keep up with the discussion.  Further, I fear that I will not even be able to understand the book!

I am still very much a stranger in a strange land.  I have learned a great deal and made some strides, but I could still be in over my head here.

So I started reading.  This is really the only way for me to discover just how accessible or obtuse the book is going to be.  Today I read chapter 1 and what follows is a summary.

Bad Code

The book opens with a cautionary tale about a software company in the 1980’s that shall remain anonymous.  This company wrote an extremely successful application, however subsequent versions contained numerous bugs and often crashed.  It wasn’t long before this once successful company went out of business.  Years later the author, Robert Martin, met one of the employees of this ill-fated company.  The person revealed that the original application had been rushed to market.  As a result, the code at the heart of the app was bad code.  Everyone knew it, but no one felt they had the time to fix it.  As newer versions of the app became necessary the code got worse and worse.  Finally it was untenable and the company collapsed!

As a fledgling programmer, reading this astonished me.  Bad code brought down an entire company!   

That was enough to scare me straight.  I don’t EVER want to write bad code.  Which leads to the question, what is good code?

Good Code

The author calls good code clean code and spends a majority of the chapter defining what it means to write clean code in broad strokes.  He does this in an interesting way.  He interviewed several eminent programmers and asked them, “What is clean code?”

I noticed several of the same adjectives and ideas used to describe clean code by these titans of computer science.  According to them, clean code is:

  1. elegant
  2. efficient
  3. simple
  4. direct
  5. contains minimal dependencies
  6. reads like well written prose
  7. can be maintained and enhanced by someone other than the original author
  8. well tested
  9. free of duplication
  10. written by someone who cares

It was an eye opening experience for me to read about programmers describing their work almost in the same way that an author might describe a piece of writing.  In fact there are many parallels between stellar writing and clean code.  Elegance, readability, and passion are necessary for writing prose and code.

After reading and digesting chapter one, I feel a little bit better about my ability to comprehend the book.  But the sections that contain actual code are yet to come and I know those parts will be a real challenge.

For now, my take away is that there is an art to computer science.  It is not good enough to throw something together that works.  The code needs to be beautiful as well as functional, clean as well as marketable.  It is up to the programmer to take responsibility for the code and do it right they first time.  No excuses.


5 thoughts on “Clean Code: Chapter 1

  1. I look forward to reading Control, Alt Believe, the Book, some day, when you are a famous code-developer Sounja 🙂


  2. Many of us believe as you do, that writing code is like writing poetry or prose. One old programming guru, I forget which, when asked about the best qualification for being a good programmer said “Complete mastery of their native language.” Did anyone suggest “The Elements of Programming Style” by Kernaghan and Plauger?

    Thanks for your post, it inspired me to post my thoughts on the subject


    • No one recommended “The Elements of Programming Style.” The books we voted on were “Clean Code”, “The Pragmatic Programmer”, “Domain-Driven Design. Tackling Complexity in the Heart of Software” by Eric Evans, and “Growing Object-Oriented Software, Guided By Tests” By Steve Freeman and Nat Pryce. Are you familiar with any of these titles?


      • My mention of Kernighan and Plauger was prompted by your remark about the parallels between good coding and good writing. “The Elements of Programming Style” is explicitly modeled on “The Elements of Style” by Strunk and White. Like Strunk and White, Kernighan and Plauger is a little book that can be read in one sitting. It might be less suitable for your book club. It doesn’t have exercises, and I think the examples are still in Fortran and PL-1, even in the latest editions, but it’s a little book, and it sets down succinctly many of the points that I saw in the few chapters of “Clean Code” that I glanced at on the web.

        I’m not familiar with any of the books you mention. Your book club sounds like great fun. Good luck!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s