|
Hello Brad,
David Prowack has given a good answer as to why JavaScript and Java are more
dissimilar than similar. However
I wanted to comment on the self-documenting aspect.
JavaScript is fairly self-documenting because the designers chose good names
(in most cases) for the objects
and their attributes. In the same way the naming convention chosen by the
designers of CPF makes our
favourite Command Language self-documenting. If you know the naming convention
you can 'guess' the object
types and likely command names.
No-one needs a comment in CL like:
/* Create file */
CRTPF QTEMP/WORK RCDLEN(132)
Tell why the file is being created and how it will be used. I can tell from
the code what is happening.
In OO NAMES ARE REALLY, REALLY, REALLY, TRULY, EXTREMELY, AND VERY
IMPORTANT!!!! A lot of time should be
spent in designing the names of classes, the names of the methods, the names of
the attributes, even the names
of the instantiated objects should be carefully chosen. Even to the extent of
considering the correctnes of
names like toString() and asString(). Do this right and the code becomes
self-documenting -- which is not to
say that comments are not still required but less of the reiterative type will
appear.
Comments should illumiate not reiterate.
And of course, my usual trailer: Any programming language can be
self-documenting (within language limits
like 6-char names) if good names are chosen.
I once saw a C program that had a dozen different 'sleep' variables -- wait,
sleep, slep, siesta, sieta,
sleep2, snooze, etc -- notice the similar names with minor spelling variations?
(Shocking thing was it was IBM
code -- although not AS/400 code -- and it still gives me nightmares!) There
is little excuse in RPG for
TEMP1, TEMP2, TEMP3, etc but never in a language with long name support.
Regards,
Simon Coulter.
«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
«» FlyByNight Software AS/400 Technical Specialists «»
«» Eclipse the competition - run your business on an IBM AS/400. «»
«» «»
«» Phone: +61 3 9419 0175 Mobile: +61 0411 091 400 «»
«» Fax: +61 3 9419 0175 mailto: shc@flybynight.com.au «»
«» «»
«» Windoze should not be open at Warp speed. «»
«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.