Bugs can be code styling errors

I just found this while debugging an issue:

if ( isConfigured() ) 
    if ( isAllowed() ) 
        doTask(); 
else 
    noConfigurationIssue(); 

I can’t tell you how many times I looked at that before I saw where the problem was. My brain was so used to following styling hints to see control of flow that it didn’t notice that the actual true flow was different from the visual flow. @*&^!

About Dave Vest
Founder and chief blogger at Mythicsoft Ltd.

One Response to Bugs can be code styling errors

  1. Dev says:

    That’s why you should always use blocks ({}), even for a single line of code.

    It’s worth the screen estate!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.