I've often come across bugs that have been caused by using the ELSE construct.  A prime example is something along the lines of:

If (passwordCheck() == false){
    displayMessage();
}else{
    letThemIn();
}


To me this screams security problem.  I know that passwordCheck is likely to be a boolean, but I wouldn't place my applications security on it. What would happen if its a string, int etc?

I usually try to avoid using ELSE, and instead opt for two completely separate IF statements to test for what I expect.  Anything else then either gets ignored OR is specifically handled.

Surely this is a better way to prevent bugs / security issues entering your app.

How do you guys do it?

The else block should always consist of what you want the default behaviour to be.

There's no need to avoid them, just be careful to use them appropriately. 

In your example, the default state should be to not allow access. A little refactoring leaves you with:

If (passwordCheck)
{
   letThemIn();
}
else
{
   displayMessage();
}


i.e. if the password check works, let them in, otherwise it's always valid to show some error message.

You can of course add additional checks to you logic by using else if rather than completely separate if statements.
