Writing readable code is as important as writing high performance working code. One of the things which can easily affect the readability of the code we write is improper structuring of if/else blocks. Consider the following example method

Private void Update()
{
If(this.CanUpdate)
{
//few lines of code here
}
}

A better way to write the above code is

private void Update()
{
If(!this.CanUpdate)
Return;
//few lines of code here
}

The difference is pretty clear. Instead of wrapping the entire code inside the if block, we use if statements to check whether the conditions required are satisfied or not. If not we just leave the method. The second version is much simpler and readable than the first version. Of course the example given here is very basic and straightforward, however attempting to simplify the if/else branches and nested if/else statements will greatly
Improve the readability and maintainability of your code base.

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList