Oh.. your mother language can introduce confusion…

Well, there are some situation where you NEED to use affirmative variable names for boolean variables.

For example,

BOOL isOK; // YES/NO is clear
BOOL isNotOK; // YES/NO?

In the case of isOK, it’s very clear if it is set to YES or NO.
But for isNotOK, if set to YES, does it mean ‘is not OK’ or ‘is OK’?
If you think more in ‘computer language’, you will be affirmative to the variable.
So, if isNotOK is YES, it is ‘is not OK’, while NO is ‘is not not OK’ ( thus ‘is OK’ ).
However, if you are more ‘human language’ oriented, assigning YES to isNotOK means ‘is OK’, while NO means ‘is not OK’.

Most computer languages are modeled after English.
But people from Germany and Korea would think it differently for negative ones.
YES to negative question is to affirmative to negative question itself.
So, YES to isNotOK is ‘is not OK’ and No to isNotOK is ‘is OK’.

So, let’s use affirmative variable names to reduce confusion. :)


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: