« Don't Think "Tomorrow"; Think "A Decade from Now" | Main | Best practices when macro substituting »
August 30, 2008
Employ "white space" in your code
Make your code more readable (by not jamming it all together) and, therefore, easier to maintain.
Examples:
a) Code examples:
Without white space, the code is not as readable:
REPLACE CB_UnitsBilled WITH ;
(lnBillableDaysTotal/DAY(GOMONTH(C_ClaimHeader.CH_From,1) ;
-1))*CB_UnitsBilled
With white space, the code is more readable:
REPLACE CB_UnitsBilled;
WITH ;
(lnBillableDaysTotal / DAY(GOMONTH(C_ClaimHeader.CH_From, 1) ;
- 1)) * CB_UnitsBilled
Of course, with good comments, the command makes the most sense:
* Units Billed = (Total Billable Days / Total # Days in month) x
* Authorized Units
REPLACE CB_UnitsBilled WITH (m.lnBillableDaysTotal / ;
DAY(GOMONTH(C_ClaimHeader.CH_From, 1) - 1)) * CB_UnitsBilled
b) Inserting a space after each semicolon (";") makes your PATH setting in configuration files and SET PATH commands in VFP code more readable:
Without white space, the path is not as readable:
PATH = C:\App;C:\App\Data;C:\Program Files\Microsoft Visual FoxPro 9;C:\Stonefield\SfCommon;C:\Stonefield\SDT;C:\Stonefield\SDT\Source;C:\Stonefield\SDT\DBCX
With white space, the path is more readable:
PATH = C:\App; C:\App\Data; C:\Program Files\Microsoft Visual FoxPro 9; C:\Stonefield\SfCommon; C:\Stonefield\SDT; C:\Stonefield\SDT\Source; C:\Stonefield\SDT\DBCX
The above examples demonstrate intraline (horizontal) white space (making it easier to read your code from left to right); also employ interline (vertical) white space (to make your code easier to read from the top down).
Posted by abergquist on August 30, 2008 | Permalink
TrackBack
TrackBack URL for this entry:
http://www.typepad.com/t/trackback/384091/32928518
Listed below are links to weblogs that reference Employ "white space" in your code:




