Clean Code: Being A Qualified Programmer

In the last few weeks, I read Robert C. Martin’s excellent book Clean Code: A Handbook of Agile Software Craftsmanship. I am an experienced programmer who has more than 12 years of programming experience (That’s true! I started programming when I was 9). I can write many programming languages, like Pascal (my first programming language), C, C++, Python, Go, Java, JavaScript, MATLAB, Julia, Verilog. Still, I cannot find a good way to write beautiful programs until I read this book.

What Clean Code Covers?

Clean Code covers a pretty wide spectrum of coding. In total, it has 17 chapters and lots of examples in each chapter. The language it demonstrates is Java, and it adopts Object-Oriented Programming. Personally speaking, I dislike OOP since Go does not support it. However, I still find lots of essential reflections in programming to share. I will separate my share in a series:

In the following of this sharing, I would like to share my coding experience of Go programming.


Is Go the future?

Personally speaking, Go is my favorite programming language now. Undoubtedly, Go’s features of parallel computing like its Go routines and its easy GC make me enjoy programming Go, but more importantly, Go is that kind of language with a STRONG standard. By saying a STRONG standard, I mean that even the most naive programmers can produce standardized and readable codes.

For example, Go prohibits unused variables from the compiler’s point of view. If you have an unused variable in your function, you cannot even compile your program. I still remember seeing lots of destructive codes with a significant number of unused variables. And whenever you ask them why it could happen, they likely abandon those variables during code refactoring without cleaning the obsolete codes. Even though GCC compilers may throw a warning, who cares, especially the new coders?

Moreover, Go’s naming rules are tricky but expressive. Here are some examples:

  • All names must follow Camel-Case like user_ID should be transformed as userID. Even more, Gofmt will throw a warning to help you change userid to be userID.
  • The variables and functions with capital names are global ones, while those with lower cases are local ones.
  • One can use _ as the variable name to discard; that is, Go uses _ to be an unused variable.

Some may doubt that coding in Go is not free. But personally speaking, I really enjoy this kind of convention and regulations. I do not need to think too much when I program. Everyone follows the same rule, so when I add new codes to an existing project, I do not need to pay attention to whether it is Camel-Case or Underscore. It saves me lots of time since I am a patient with difficulties in choosing (选择困难症患者).

Countless examples are showing Go’s regulations improve coding and cooperation efficiency. I think if you have time, just make a try and you would love it.

This week I just got my driving license for manual gear. However, I promise when I buy my own car in the future, I will definitely buy an automatic one. When I am driving, the only thing I think about when I am driving is to reach the destination faster and safer, not the joy, so why should I pay most of my attention to my gear when I am driving? Isn’t it more enjoyable to talk or listen to my favorite CD when I drive? The same thing applies to programming. The only thing I care about is how to write expressive and bug-free codes to solve problems, not showing my (ugly) tricks and annoy others! So I choose Go Language! (Maybe after I learn Rust, I would switch to Rust, lol).

If you want to buy the book:

3 thoughts on “Clean Code: Being A Qualified Programmer

Leave a Reply

Your email address will not be published. Required fields are marked *