ciplogic.com
Live with grace. Write superb software.

Did your mind needs to stop to read (taken from ckeditor source):

1
2
if ( !dontRemove )
    removeNoAttribsElement( element );

Well you're not alone.

Stop using double negations, even if your code looks "cleaner", and refactor them to be single negations.

A simpler rule is never use negation variable names, so you don't run into issues like this. So don't use names such as: "noElementPresent", "dontRemove" or "notExisting".

For the previous example instead of "don't remove" go with "keep element", "keep", or something along those lines. Just search a thesaurus if you can't find a word.

1
2
if ( !keepElement )
    removeNoAttribsElement( element );

Notice how readability is just so much better.

Disqus Comments

comments powered by Disqus

Germanium

The one to rule them all. The browsers that is.

SharpKnight

SharpKnight is an Android chess game.

MagicGroup

MagicGroup is an eclipse plugin.