Gå till innehåll

Insights I got when reading Clean Code

A friend of mine is a software developer. He is of the passionate kind that really cares about the code he writes. I have the utmost respect for him. When he talks about coding, I listen. We had lunch the other day and he mentioned the book Clean Code by Uncle Bob Martin. In his opinion this should be mandatory reading for all developers. Since I am always hungry for valuable learning I ordered the book. I spent the last two days reading it. OK, I admit, I am not a developer and I have not written a lot of code but none the less I found it interesting.

Clean code is about how to be a professional developer. You can be great at coding stuff but it is different to be professional. The difference is that you do not only solve a problem but you solve with code that it easy to read for others which means maintainable. Interesting idea that comments should be avoided most of the time. The code should be so clear that it tells you what it does when you read through it. Good naming, simple functions, no duplication, indentations, clean unit tests as well. If you do not follow these practices your code will be a mess. Hard to read, lots of bugs, hard to update. In this view all automated tests is programming as well!

This leads me to the following conclusions: many people write code but few do it professionally. If you want to be a professional programmer – you have to practice hard and really want to become one. Constantly refactoring and writing tests takes a lot of effort, if you give up - the code will deteriorate fast. Automating testing is really an integrated part of development. Contrary to some popular belief, I don’t think you can just take any tester and assign them the task of automating the manual tests they are doing today, neither is it a good idea to ask them to write the unit tests. This is really writing code as well, and writing code professionally requires you to really want to write good code.

I work with a couple of really skilled developers at the moment. They know the technical stuff, they care about their code. When they tell us that they will not deliver new functions this week because they need to refactor and fix a lot of small bugs, we tester applaude! However I notice a lot that most developers have a hard time seeing the whole picture. They are very focused on solving the problems at hand and do it well technically. A nice user interface and the ability of seeing the whole picture is much lower priority than creating working code. Now I respect that, and they respect that we testers find a lot of bugs that they do not notice. I think it would be a really poor choice to make tester code and developers test more. The strength of our team is that we are good at different things. I really think the idea of everyone being able to do everything is a misunderstanding. I think it is very beneficial if developers can handle different types of coding and that testers can handle different types of testing. But that is not the same thing as everyone beeing a developer.

Both developers and testers need to become more professional. If I was a developer I would read Clean Code and do all the exercises and I would give a copy of that book to all my colleagues. Now I am a tester so I read the book to understand what developers go through. I also hand out copies of my own book on test design to members of my projects so they can understand testing better. I read about Lean, Kanban and Scrum so I understand what is happening in the agile world of today. I am really surprised and disappointed that most project managers don’t seem to care about that new stuff called Scrum when they are supposed to manage a Scrum project on some level. I learn about Effect mapping so I can help making the users happy.

Professional developers are the core of all software projects, but so are the testers. Without one or the other we will fail. Those who believe that all testing can be automated have totally missed the point, those who believe that automating testing is a waste of time have also missed the point. Both are needed but they have a very different focus. Manual testing can never make the code clean – only developers can do that using other techniques. Good manual testing will give invaluable information in order to make the application useful – help the user solve their problem!

And yes, I am really looking forward to our upcoming conferences this spring. SWET peer conference in March and Let’s test in May. The latter one open for the public. Let is discuss and bring software development one step further ahead towards real professionalism!