Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

A forget-me-not to remind me to remember not to forget

by davies (Prior)
on Nov 27, 2007 at 12:39 UTC ( #653204=perlmeditation: print w/replies, xml ) Need Help??

... with apologies to Benny Hill!

Last night, someone in the chatterbox was asking about xcopy, and I produced a line from my backup batch which did - I think - everything needed. Certainly it does everything I need. An inoffensive comment was made about how ridiculous the line in question looked. I commented that, since it was past midnight, I couldn't remember and wasn't going to look up the meaning of every option.

Lying awake in the small hours, I remembered for no good reason the cobol compiler options we once discussed when I was at University 30 years ago. There were two schools of opinion on which worked better - ARSE or SEX. These are the sorts of games with compiler options that can amuse teenagers. However, the point is that I can remember both those sets of options, which is best and why, and what each one bar one (E - it did something mildly beneficial, but wasn't essential) does. It's not much use - I can't see anyone asking me to punch cards for a Univac 1110 again, but I do remember those compiler options, and don't remember the options for the Fortran and Pascal compilers.

A week ago, I was playing bridge, and before play, I was asked by a couple of friends about various conventions. In both cases, I was able to quote mnemonics to help them from books written by Ron Klinger. He also writes about how to play your cards in such an order that the enemy have the greatest difficulty in remembering. So my question applies to a wider world than just Perl or computing.

Learning Perl, 3rd Edition, By Randal L. Schwartz and Tom Phoenix says that $ and @ were chosen so that they could be read as $calar and @rray. Perl clearly has its obfu devotees, but what about the reverse of this (let's call it "ufbo"). While things like sensible names, comments and indentation are relatively old hat, what other techniques are used to make it easier for (a) the programmer, (b) the fabled maintenance programmer, and (c) the user to remember what things do? The Benny Hill line I used as the title and the cobol compiler options are permanently embedded in what passes for my brain. I'd like to get more useful stuff to stick, too.

For the sake of completeness, the xcopy command was:
xcopy c:\ m:\c /e /c /h /r /k /y
and I still don't remember what all the options are!


John Davies
  • Comment on A forget-me-not to remind me to remember not to forget

Replies are listed 'Best First'.
Re: A forget-me-not to remind me to remember not to forget
by ww (Archbishop) on Nov 27, 2007 at 13:17 UTC
    • POD
      ...and when I'm on good behavior, that means a fairly extensive pod, with caveats, gotchas, and usage examples, if the script has more than a very few options. (Sometimes I have the feeling that many script writers carry over their key-stroke saving practices, as used within a script, to the documentation, where such terseness can be a significant obstacle for the "future user.")
    • a useage sub or block called when required arguments are not present or when user adds (any of) ?help, /h, /help, etc
    • in line comments on any code I find "tricky"
      ...for which the maintenance programmer's or future user's mileage may vary

    The last is sometimes disparaged, as "inelegant" or even "inept" but like your Cobol options, IMO such comments are worth enough (even for the current writer, 6 months later) to discount the disfavor they earn with some people, as not all prospective maintainers/users will know the meanings as you do.

      Indeed, ww. I retain enough of my assembly language background that I often keep up a running commentary alongside my code. I find that if I keep the hashmarks lined up, it doesn't detract from my ability to read just the code.

      My desire to add these comments, some of which help and some of which are just a PITA distraction, does often conflict with coding standards that say that thou shalt line-wrap at 78. Then again, I don't often use camelCase, either... ;-]

      For me, generally, the utility of the commentary outweighs the need to tidy it up every time I edit, because -- as in education -- if you can explain something well you understand it better. I find that switching back and forth from programming language to English language gives me time to consider what I'm doing. It's especially useful to go back and add comments with a cup of coffee after a late-night flow session where I've added a whole bunch of new code.

      I'm still looking for the syntax highlighter or literate programming editor that'll let me selectively choose either just code, just comments, or both, but until I find it, I'll keep my left-right code and commentary style.

      Of course, I'm also the guy who says that two-finger typing helps me write better code because I have time to think between pecks... ;-D

      Don Wilde
      "There's more than one level to any answer."
Re: A forget-me-not to remind me to remember not to forget
by SkipHuffman (Monk) on Nov 29, 2007 at 19:47 UTC

    The xcopy switches I always remember are /h /o /t /s /e /r /v. Lets see if I can remember all the meanings. er, /h hidden files also, /o overwrite destination, /t include system files, /s recurse into subdirectories, /e include empty directories, /r wait... maybe /r is recurse...then what is /s..., /v verify after write.

    I learned this on OS/2

    we used this to basically image an entire drive instead of installing from thirty some odd diskettes.


      I can't remember any xcopy options (for I did every copying in dos with norton commander), so I looked them up.

        I guess OS/2 has a couple different options. I might have to fire up my system tomorrow.

      WinXP>xcopy /? Copies files and directory trees. XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [ +/W] [/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T +] [/U] [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/EXCLUDE:file1[+file2][+file3]...] source Specifies the file(s) to copy. destination Specifies the location and/or name of new files. /A Copies only files with the archive attribute set, doesn't change the attribute. /M Copies only files with the archive attribute set, turns off the archive attribute. /D:m-d-y Copies files changed on or after the specified date. If no date is given, copies only those files whose source time is newer than the destination time. /EXCLUDE:file1[+file2][+file3]... Specifies a list of files containing strings. Each str +ing should be in a separate line in the files. When any of + the strings match any part of the absolute path of the file + to be copied, that file will be excluded from being copied. +For example, specifying a string like \obj\ or .obj will ex +clude all files underneath the directory obj or all files wit +h the .obj extension respectively. /P Prompts you before creating each destination file. /S Copies directories and subdirectories except empty ones +. /E Copies directories and subdirectories, including empty +ones. Same as /S /E. May be used to modify /T. /V Verifies each new file. /W Prompts you to press a key before copying. /C Continues copying even if errors occur. /I If destination does not exist and copying more than one + file, assumes that destination must be a directory. /Q Does not display file names while copying. /F Displays full source and destination file names while c +opying. /L Displays files that would be copied. /G Allows the copying of encrypted files to destination th +at does not support encryption. /H Copies hidden and system files also. /R Overwrites read-only files. /T Creates directory structure, but does not copy files. D +oes not include empty directories or subdirectories. /T /E incl +udes empty directories and subdirectories. /U Copies only files that already exist in destination. /K Copies attributes. Normal Xcopy will reset read-only at +tributes. /N Copies using the generated short names. /O Copies file ownership and ACL information. /X Copies file audit settings (implies /O). /Y Suppresses prompting to confirm you want to overwrite a +n existing destination file. /-Y Causes prompting to confirm you want to overwrite an existing destination file. /Z Copies networked files in restartable mode. The switch /Y may be preset in the COPYCMD environment variable. This may be overridden with /-Y on the command line.

        That looks like XP not OS/2, but thanks


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://653204]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2020-07-05 20:32 GMT
Find Nodes?
    Voting Booth?

    No recent polls found