[thelist] your opinion solicited on coding specs I requested from contractor

Ornstein, Ian IanOrnstein at NC.SLR.com
Mon Oct 22 15:57:14 CDT 2001


I've been reading this thread, time to add my two cents.


Regarding JavaScript ( and styles)
It seems there is a shortage of newline characters.
I don't remember reading about the shortage..I just started
seeing code that was harder to read as in

function doessometingtosomedata( abc,qwerty, asdf) {

well the { belongs on the next line.
I feel that having matching braces aligned vertically adds readability.
This also applies to for if else  etc.
Next indent level: use four (4) spaces not two spaces and not tabs.

Declare every var at the top of the function ( not inline folks ) and
give it a meaning full name perhaps even a // comment.
Each one deserves its on line.

Do not accept coding the convention where    new function is used.
Functions should be defined, given a name and referenced by that name.

Although this may be consider optional, single character loop variables
are of questionable propriety. Certainly x doesn't communicate whats
happening.  If the loop is for the forms collection on the page,
how about intForm as a loop varialble?

George Symoni created  a naming convention used
by Microsoft developers wherein the variables are prefixed with 
an abbreviation that indicates a datatype.  Most developer resist it
but quickly see the benefit in improved readability.

Remember maintenance and enhancement over the life of a program
represent 4 times the development time.  Do you think you will
be able to read cryptic code six months or two years form now?

- IanO -




More information about the thelist mailing list