Asier's thoughts

Blogging about software development


DRY – Don’t Repeat Yourself

The first principle of the red grade is Don’t Repeat Yourself or DRY. It’s origin can be found in the Pragmatic Programmer, one of the most important books in the programming world.


DRY tackles code repetition and states that we should avoid it.

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

Quite simple and obvious thing. However, not everybody follows this. The copy and paste is much easier than having to think how to avoid this duplication.

Much easier? well, at the moment.. But what about when you came back to that piece of code and whant to change something? You will have to make sure that you are making the change in every duplicated piece.. if the duplication has happened in more than a place this could became a maintenance nightmare. Also, this duplication it is just clutter in the code which makes in more difficult to read. And we spend most of time reading code.

So, if you want to write maintainable clean code DO NOT REPEAT YOURSELF!



Clean Code Development: Red Grade

Today I am starting with the Red grade of clean code development.

The principles are:

And the practices:

  • Follow the Boy Scouts Rule
  • Root Causes Analysis
  • Use a Version Control System
  • Apply Simple Refactoring Patterns
  • Reflect Daily

As you can see, the principles and practices of this grade are not very complicated. The idea is too fully understand and know them, bringing them to everyday’s work and ultimately to master each of them. This is important since this are the bedrock for the next grades.

More detailed info at


Clean Code Development

In the last few years in the software development world there have been a movement towards Software craftsmanship. Basically, this means writing highly maintainable software. Software which is easy to read and change. Software which last for ever! 🙂

This is known as Clean code.

Robert C. Martin – aka Uncle Bob – has written a couple of books about it. A few days ago I downloaded the sample for my kindle of one of them: Clean Code: A Handbook of Agile Software Craftsmanship. It got me captivated. So today I went to the shop to buy the paperback edition – I didn’t want to buy the kindle edition because it contains a lot of code and I don’t think the kindle is good for that.


I have also found the web site, which mainly based in this book, teaches us how to write clean code. We can find there a bunch principles and practices to follow in order to achieve this. They are separated in different colour grades: Black, Red, Orange, Yellow, Green, Blue and White. The idea is to stay a few weeks in each grade while learning and practising. Once that grade has been fully completed we will jump to the next one. Ones we get to the last colour we will start again from the first grade. We will always keep relearning with no end, in a continuous improvement.

Unfortunately, the main web site is in German. Although an English version of it exists, this is incompleted: However I found a simplified version in english: 

If you want to become a good developer and write beautiful and maintainable code, you should do as me and follow the path! Stay in each colour 3-4 weeks, learn thoroughly each principle and practice and check every day if you have put properly in practice what you have learnt. If, at the end of that period, you see you have accomplished that grade, jump to the next grade. If not, stay in that grade a bit more.


I am planning to get coloured wristbands as suggested in the web side and wear the one of the current grade in one of my arms. Check every day whether I have used the principles properly and if I haven’t move the wristband to the other arm. Once I have kept the wristband in the same arm for 3 weeks I can move forward to the next grade! All of this while I read the book.

Sounds like fun 🙂

Today I am starting with the black grade. Which is basically a starting point where I shouldn’t stay too long – it’s basically for self awareness. So tomorrow I will try to get a red wristband and jump to the next grade!