Your code looks like Chinese to me!

Perl, Java, C++ are as hard for novices to read as a randomly designed langauge.

Do you ever feel like the code you’re reading is written in a completely foreign language?

Today I learned that a couple of studies have been done on this topic. While the video that introduced me to the studies is new, the research article about the studies is nearly ten years old: An Empirical Investigation into Programming Language Syntax.

According to the video, “all of the languages in the C family, Perl, Java, C++ … are as hard for novices to read and recognize as a randomly designed language. Ruby and Python are significantly easier.”

And although Go isn’t mentioned (it was barely known at the time the studies were conducted), I imagine it would skew toward the Ruby and Python end of the scale, as one of its core design goals is to improve code readability.

I’ve often said that I, like many, came to Go for its concurrency support, but stayed for its readability. And to contrast, I’ve often used Perl as an example (having been a Perl developer for 12 years or so before learning Go).

I challenge any fresh university graduate who has never used Perl or Go to read any code written by Larry Wall (the creator of Perl), and then to read code written by Rob Pike (co-creator of Go). I’d bet a significant portion of my monthly income that the Go code will be much more understandable.

“Indeed, the ratio of time spent reading versus writing is well over 10 to 1. We are constantly reading old code as part of the effort to write new code. …[Therefore,] making it easy to read makes it easier to write.”
Bob Martin

How important is code readability to you?

Share this