Christopher Jeffery
Sep 8, 2018 · 2 min read

Clean Code gets a lot of negative comments from the community. I’ve never really understood this because this book single handedly improved my code more than any thing else.

I do not believe Robert C. Martin is saying that you should follows these principles in a strict manner. I do believe he is saying, if most of your code is breaking these principles then you could probably refactor a bit to make it more readable. If I remember correctly he does talk about such things as how does the code make you feel. So it’s not just about the principles but using a suite of tools to writing good code.

Using 4 lines per method as an example, if most of your methods are more than 4 lines then your code could probably be written better. 4, of course, is a bit arbitrary; as if 5 would be too much. The point is to keep methods small and concise. What helped me the most is thinking about the levels of abstraction and breaking functions out that way (which is talked about in Clean Code). This way of breaking out functions will keep your methods small and it is usually more readable and also very revealing.

At the same time, I’m not certain I agree with the amount of unit testing Robert C. Martin promotes. In a truly agile or extreme programming environment, I see how many unit tests would be helpful. However, I find that businesses don’t like this approach regardless of its benefits. Therefor, unit tests for pure functions have helped me the most. Also, research shows that writing unit tests for bugs is worth the time and energy. So keep that in mind.

    Christopher Jeffery

    Written by

    Software Engineer