The Clean Coder – Chapter 4 and 5

I continue to enjoy this book a lot and glean valuable information pertinent to developing myself as a professional and continue to enhance myself and my career. Chapter 4 focuses on Coding and the goals of a programmer. A software developer’s code must first and foremost solve the problem at hand. Code should solve the correct problem, and a professional developer must often determine what the correct problem actually is by interacting with the customer and business analysts. Any new code developed must integrate seamlessly with the existing system, and must be readable by any other developers.

In Chapter 4, Martin also cautions the reader about 3 AM Code and Worry Code and advises them to take a step back instead. Writing software at 3 AM after staying up all night trying to solve a particularly perplexing problem is not going to produce quality code, nor is coding while personal issues are at the forefront of your brain. I often find it hard to pull myself away from a difficult task and basically just sit at my machine making no progress, only to think of am easy and elegant solution on my drive home as Martin mentions later in the chapter. Martin asserts that taking a step back and clearing your mind will often result in seeing the problem in a new way, and a solution will come to you, and I would have to agree.

Martin also voices his opinions on The Zone and listening to music. I do believe that sometimes certain types of music like video game soundtracks help enhance my concentration and also somewhat block out outside distraction. I know distractions happen and are a regular part of work, but it can be incredibly detrimental to progress with distractions often occupying more time than dedicated development. I don’t mind interruptions as being part of a team and working towards a common goal is important, but if it hinders my own tasks and goals then it is actually quite harmful.

I’ve never really had Writer’s Block when it comes to writing code, as I usually can just move on to a different task or go through, but I see how pairing can help alleviate the inability to progress. Martin also mentions the dangers of working overtime and how it is generally only helpful in some cases. I would have to agree that helping others is also important even if it can sometimes be frustrating if you need to focus on a particular task, one should know that they also  require help sometimes, and asking for help when you need it is okay.

When I first began developing software professionally, I had the view of debugging Martin initially described in which it was something that had to be done and was not really a part of coding. But in part due to reading this book and my growing desire to be more professional, I have changed my views and always spend the necessary time debugging. However, I find it difficult to subscribe to Test Driven Development in some cases even though I believe it would be extremely beneficial.

Chapter 5 is entirely about the benefits of Test Driven Development, and Martin’s initial suspicion but eventual embracing of the practice. I’m not sure if I’m jaded or believe that it is very difficult to introduce TDD practices into an existing project with multiple systems involved. With JavaScript talking to a SaaS platform that then speaks to a Java backend, the amount of unit and integration tests is enormous, and verifying correct testing behavior for all aspects of the system is very time consuming, but generally worth it. Regression and automated testing are invaluable when it comes to developer productivity and assurance of correct behavior. TDD enables a developer to freely refactor code while ensuring that existing functionality is not disrupted. TDD also significantly reduces defect rate by verifying that new code is working the way the developer intends.

Overall I am enjoying this book and finding it incredibly useful as a tool to make myself more of a professional.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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