java - Using double negatives to test for conditions -


To validate user input, I do not know which of the two options is better

< H1> 1 pre << >> <<> east <<< >> <<> <<> <<> Noble (object input)

2

  non (object input)  

Apache's Commons Lang Library chose # 2 but I was uncomfortable with double negative I am what do you say?

For me, double negativity is always a bad thing, I would say it is soft to stick. When reading futility, it is understandable in reading. Unlike it (! IsNull (o)) // ...

who reads "If not, then zero" is sure that it Feeling slow is read aloud, but with this option # 1, it is more understandable than examining futility.

  if (! IsNotNull (o)) // ...  

A statement that makes you reverse and says "Hey wait a minute ... if not ... ".

But If there is a standard already in the names of the method, then paste it is standard good work, and should not be broken just because someone " Uncomfortable ".


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -