Friday, June 29, 2007
Be Positive
No, I don't mean in a cheesy Disney way. I mean in a nerdy boolean logic way. I'm not sure where I picked up this rule of thumb, but one particularly subtle bit of .NET developer guidance I've started to try to follow is to keep booleans positive. For example:
if (myPerson.IsActive) ... //"if the person is active".
is easier to think through than:
if (! myPerson.IsInactive) ... //"if the person is not inactive".
At first pass, this seems nitpicky and maybe even arbitrary. Doesn't this rule just make it longer to test for a negative?
if (! myPerson.IsActive) ...
But the point isn't so much the amount of code, as it is the the double-negative "not inactive", which burns a few more brain cells to get. An extension of this is when branching:
if (myPerson.IsActive) doSomething(); else doSomethingElse();
is better than
if (!myPerson.IsActive) doSomethingElse; else doSomething();
Again, the reason isn't so much for the one if..then..else, as it is for the consistency and readability of code as a whole. Anyway, it's helped me =)
Wednesday, June 20, 2007
Spell Check for VS2005
Wednesday, June 13, 2007
Windows Presentation Foundation Unleashed

Thursday, June 7, 2007
DanielRoot.com - Take 3
This is about the 3rd or 4th makeover for this site, so I've done it enough to know it's probably not the last. Things are a little different this time around- this will be primarily a .NET development blog (translation: nerd stuff), though I'll no doubt sneak in a few fishing pictures and such from time to time.
Subscribe to:
Posts (Atom)