Senior vs Junior Developer on Readable Code
While reading Simple Programmer article on Readable Code, I found a great point on how senior vs junior developer read a piece of code.
There is a fundamental difference in the way an experienced coder reads code versus how a beginner does
An experienced developer reading code doesn’t pay attention to the vocabulary of the programming language itself. An experienced developer is more focused on the actual concept being expressed by the code—what the purpose of the code is, not how it is doing it.
A beginner or less experienced developer reads code much differently.
When a less experienced developer reads code, they are trying to understand the actual structure of the code. A beginner is more focused on the actual vocabulary of the language than what the expression of that language is trying to convey.
To them, a long named variable isn’t descriptive, it’s deceptive, because it is hiding the fact that NumberOfCoins represents an integer value with its long name and personification of the variable, as something more than just an integer. They’d rather see the variable named X or Number, because its confusing enough to remember what an integer is.
An experienced developer, doesn’t care about integers versus strings and other variable types. An experienced developer wants to know what the variable represents in the logical context of the method or system, not what type the variable is or how it works.
Now, it does make sense that junior developer is more concerned with how the code works, because they are not yet familiar with the programming language.
Once they gain experience, they have better understaing of the programming language and thus able to read and write readable code.
Without understanding this difference, we will always have argument on whether readable code is useful.
Naturally to senior developer, readable code is very important and is something that is considered a must do.
There is one thing where this is useful, when recruiting, we can immediately tell a developer level of experience by simply reading his/her code.
Junior developer tends to write variable that does not make sense (not readable) because they are more concerned with how the code works.
What is your experience ?