Bookreview: Clean Code on the rescue

Clean Code on the Rescue

At Code Sherpas we suggest you start reading “Clean Code: A Handbook of Agile Software Craftsmanship-Robert. C Martin(2008)”. This book is seen as the bible of software engineering. And with daily practice you will be able to get a job on Mid or even Senior level. So, don´t give up, grab yourself a copy and keep on coding.

Good Code, Bad Code

Code is code, you might think. But that is not entirely true. Code can be divided into good code and bad quality code. But what makes code good or bad? And why bother to write good code if even bad code can function?

Excellent software crafts(wo)men

As an aspiring software engineer, a great practice is to regularly read and write a lot of code. But that in itself is not enough to become an excellent developer, software engineer, project manager, team lead or systems analyst. In order to thrive in a fast-paced Tech industry, you need to take your skills to the next level. Instead, you need to challenge yourself to think about what is right and what is wrong about the code. You also need to be clear about your personal commitment to your craft and reassess your professional work values. Take nothing for granted and constantly improve yourself by trying to understand anytime you write, read and clean up code. That is what distinguishes excellent software crafts(wo)men from the average developer.

  • PART 1: Principles, Patterns and Practices of writing clean code.
  • PART 2: Case studies & exercises of increasing complexity. Each case study is an exercise in cleaning up code and transforming a problematic code base into a clean and efficient one.
  • PART 3: Bad Code Examples. The last chapter consists of a list of “code smells”, gathered while creating the case studies.
  • GOOD vs BAD code: How to distinguish between good and bad code
  • GOOD CODE: How to write good code
  • REFACTOR CODE: How to transform bad code into good code.
  • NAMING: How to create good coding names, functions, objects and classes
  • FORMATTING: How to format code for maximum readability
  • ERROR HANDLING: How to implement complete error handling with correct code logic
  • UNIT TESTING: How to unit test your code
  • TEST-DRIVEN DEVELOPMENT: How to practice test-driven development

The 7 rules of Clean Code

The book distinguishes seven most important best practices for clean code:

RULE 1: Names matter

Independently of what type of data naming is used- be it a variable, function, parameter, class or method- names matter for clear code:

RULE 2: Boy Scout principle

Based on the camping principle of Boy Scouts, in programming:

RULE 3: Tell a story

Programming is like telling a story. As the programmer is the author of this coding story, (s)he needs to take care of how the story of code is presented:

RULE 4: DRY principle (Don’t Repeat Yourself)

In Coding, less is more:

RULE 5: Comment only if needed

In a Code Base, code is modified, but comments are not:

RULE 6: Error handling

Handling Errors and exceptions correctly is an important skill to have as a programmers developing software:

RULE 7: First test, then Code

Although often forgotten, when learning to code, carrying out unit tests in the programming area is a very important stage. A code is only considered clean, after being valid through tests, which must also be clean. The best way to write a test, is to write the test, before writing any code. This is what is called a Test-Driven Development (TDD):



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Diana Vilé

Diana Vilé

A passionate Digital Communication Professional from Barcelona, Spain. Experience: Content, UX-design, Frontend.