MessageHandler is challenging the IoT community
blog.messagehandler.net2 pointsby chton0 comments
if(IsNotFoo) {}
you can do if(!IsFoo) {}
It's a simple thing, but it can save you valuable time and brainspace at some point in the future. IsEntityPersisted()
WasActionPerformed()
IsFooOfTypeBar()
etc. entityIsPersisted
actionWasPerformed
fooIsOfTypeBar
The important thing in both cases is to name the boolean for what it means, why you'd set it to true or false, not for how you intend to use it. Compare: if(logicFlag)
{
//do something
}
vs if(actionWasPerformed)
{
//do something
}
Clarity in a naming schemes is all about making it clear what something means in the context. I know that sounds like a tautology, but there is a difference between "what something means" and "what something does in the application". If you manage to make the meaning clear, the reasons for what it does will become clearer too. The reverse is rarely the case.
I believe the reasoning for why that should be goes back to the cycle of poverty (http://en.wikipedia.org/wiki/Cycle_of_poverty). It's harder to make more money if you don't already have more money. By giving a one-time lump sum, you give people the opportunity to dig themselves out of that hole. Eating better, dressing better, buying things that last longer, these all have big impacts on how much one can save and earn. Even getting some basic education helps enormous amounts. In the end, it might even lead to people being more willing to work harder and actively save more money.