Some reader knows my preference for programming languages like python or javascript. One reason is the readability (yes, this is possible with many languages except brainfuck or whitespace). Once we write some lines of code, but other developer has to read the lines of code several times while code reviews, debugging or refactoring.
Code should be readable like your normal language. I will start with a funny condition.
if ( !notOk != false ) {
userObj.ask();
}
This is only confusing and you will never formulate this expression in a natural language. With several steps this term can be simply resolved:
( !notOk != false )
( !notOk == true )
( !notOk)
- now you should rethink the variable name:
isOk = !notOk
And the result is more readable:Read more