I was watching the video Clean Code and in the video, no other than Uncle Bob explained what is clean code.

Uncle bob, for those who are not familiar, is a legend in the software development world, let’s see his description on Wikipedia.

Robert Cecil Martin, colloquially called “Uncle Bob”, is an American software engineer, instructor, and best-selling author. He is most recognized for developing many software design principles and for being a founder of the influential Agile Manifesto. Martin has authored many books and magazine articles.

But this post is not about Uncle Bob, but about what other people think of a “clean code”. According to Uncle Bob, he asked several experts the question: “What is clean code?” Let’s see what they replied.

Bjarne Stroustrup, the inventor of C++, said

" I like my code to be elegant and efficient. Clean code should do one thing."

Elegant code is code that does a lot in a few words. Efficient code is code that uses very few CPU cycles.

Grady Booch, the author of this 1990s classic, Object-Oriented Design, and Analysis with Applications, said

“Clean code is simple and direct. Clean code reads like well-written prose.”

Michael Feathers, the author of Working Effectively with Legacy Code, said

“Clean code always looks like it was written by someone who cares.”

Ward Cunningham, the inventor of wikis said

“You know you are reading clean code when every routine that you read is pretty much what you expected.”

So we have some definitions, a Clean code is elegant and efficient, simple and direct, is written by someone who cares, and reads pretty much as expected.

If the code is clean, it reads as expected, meaning you can understand it very easily. That is the goal.

As Uncle Bob himself said:

“Remember that it doesn’t require an awful lot of skill to write a program that a computer understands. The skill is in writing programs that humans understand.”

A bonus quote from the video, one that I live by is what Robert Baden Powell, the father of the boy scouts, left a posthumous exhortation to the organization he founded. He told them:

“Leave the world better than you found it”

If we did that with our code? What if we left our code better than we found it? What if every time you checked a module in, you checked it in just a little bit better than you checked it out?

That is what I always try to do, improve something around the code that I am working on my tasks, this way, we slowly improved the overall codebase.

Happy coding!


Photo by Oskar Yildiz on Unsplash