7
When writing a code you must do it so that the time required for your understanding is minimal. This is the most important metric to have a readable code and is the foundation of the fundamental legibility theorem.
The more time you spend, the less readable your code is, and that’s a sign that it needs readability improvements. An illegible code today may be your loss of productivity in the future. What you do today, with total understanding, in a couple of years when you need to do a maintenance, can be unreadable even for yourself, and this will make you spend valuable time trying to understand what you wrote yourself.
So what would be the interesting ways to apply this theorem and measure the readability level of the code?
Is not desirable that the answers to this question are based on opinions but rather on facts, references or specific experience.
I must understand that the negative vote says that there is no need to worry about legibility, any written crap anyway is good, as long as it works
– user60252
I did not vote against, but I suppose whoever it was simply understood that the question is too broad. In fact, "legibility" is a nebulous concept, and a good style in one language can be a bad style in another. Incidentally, it can vary from project to project. And the line separating "opinions" from "specific experience" is tenuous...
– Wtrmute
I wrote an article a few weeks ago for a blog where I describe some practices for leaving a self-documented code. Here is the link: http://www.sigaonerd.com/2017/06/vba-artigo-034-left_codigo.html I hope the article will help answer your question. The best thing is to read the book I put as a reference at the end of the article.
– PedroMVM
The question goes for any language and the answer will be the same. Now, to avoid shooting yourself in the foot with Javascript, I recommend the book Javascript: the good Parts.
– Oralista de Sistemas
Related: What makes a source code an easy to maintain code? and What is "idiomatic expression" in programming?
– rray