Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Naming conventions again........
Message
From
28/08/1999 00:05:13
 
 
To
27/08/1999 19:59:00
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00258085
Message ID:
00258759
Views:
20
Hurrah, Melissa!

Well said!



>>>4) indentation (preferably using spaces)
>>
>>Good Points. I was wondering abou this one however? Whats the advantage?
>>
>
>The advantage is readability.
>
>Indentation in any language is always a good practice to make your code readable. For example, if you have an if statement, you would indent the code within the if statement. This makes it far easier to determine code which may only conditionally be run or code which is in loops. An added benefit is indentation makes it much easier to quickly see if you have missed an endif, endcase, endfor, etc.
>
>In my spare time, I'm the head coder for an Internet game. All my coders know that if they are asking me for help, their code had better be indented. I had the same rule when I was the tutor for intro programming classes at the local university. It becomes a real hassle to trace down nested loops, conditional branching, etc without the benefit of indentation.
>
>Consider the following:
>
>do case
>case var = 1
>if var2 = 1
>ret = 12
>else
>if var3 = 1
>ret = 13
>else
>ret = 10
>endif
>endif
>otherwise
>if var2 = 1
>ret = 2
>else
>ret = 1
>endif
>endcase
>
>Compared to:
>
>do case
>    case var = 1
>        if var2 = 1
>            ret = 12
>        else
>           if var3 = 1
>               ret = 13
>           else
>               ret = 10
>           endif
>        endif
>    otherwise
>        if var2 = 1
>            ret = 2
>        else
>            ret = 1
>        endif
>endcase
>
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Previous
Reply
Map
View

Click here to load this message in the networking platform