On 30/03/2016 2:12 PM, Elardus Engelbrecht wrote:
David Crayford wrote:
I'm not as dogmatic as Elardus WRT comments.
I'm not dogmatic. Did you see my smileys and my serious note that comments are
life savers?
I was just replying to Phil's tongue in cheek comment about starting a 'war'. I
still remember the past 'war' about acronym USS.
I was joking! I forgot the use a smiley, sorry :)
In fact I'm quite the opposite. I believe that if you need lots of comments to
understand code then that is an indication that the code is poor and needs to
be refactored.
Indeed. What you wrote is very true. Especially if you need to debug an
Assembler or COBOL program written by others. Where possible, I insert or
correct comments to explain changes to source code applied.
I have once a bad case of a COBOL program producing 0Cx abends. A programmer
wrote the program and called programs with few comments. Next programmer added
features, but wrote comments describing the logic incorrectly. Yet another
programmer 'fixed' the program based on that faulty comment. Result - I had to
debug the thing and fix the comments also.
I think Assembler is the one domain where heavy commenting is still
required because it's such an arcane language. But high-level languages
should be pretty much self-documenting, which in fact is the great
strength of COBOL. It has it's detractors but it's not a read only
language. A lot of the Java code I read is junk.
If somebody says to me "I've written lots of comments for that function
because it's tricky code" the alarm bells start ringing. Don't comment
tricky code, re-write it until you can understand it. We should strive
to write code to be read and understood by humans without requiring
short essays every few LOC.
Go and take a look at zLinux IPL code
http://lxr.free-electrons.com/source/arch/s390/kernel/ipl.c. There's not
many comments in that module but it's crystal clear what it's doing
because of a good naming convention, good constant defintions,
functional decomposition and well crafted code. When you see a comment
you know you should read it because it's important. I'm not saying don't
write comments, I'm saying don't write useless comments. Doc comments
are mandatory and always thoroughly comment data structures and
algorithms. Comments that echo lines of code are the work of the devil.
You see, now I'm being dogmatic!
recordCount++; // increment record count
One of the compelling reasons for using an OO language is to avoid conditional
logic with language features such as polymorphism. In the case of your REXX
class I would refactor your select statement into methods for each function
type. You can then chain the method calls to perform all three functions in
one statement.
Very interesting approach.
FWIW, for this kind of stuff on Linux I usually just write a bash script.
Could you please be kind to provide any example(s)?
Simple script to perform both full and incremental backups. You have to
love the Unix philosophy :)
http://www.cyberciti.biz/faq/linux-tape-backup-with-mt-and-tar-command-howto/
Groete / Greetings
Elardus Engelbrecht
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN