Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Jan Waclawek
08/16/05 03:27
Read: 1007 times
Bratislava
Slovakia


 
#99497 - proofreading
Responding to: Erik Malund's previous message
This all is more about psychology than anything else so speaking from (here: my) personal experience is not a valid and universal method, that's true; and I don't have time nor money to conduct a proper research. But let me be subjective.

The proofreader - as all men - is lazy. If he has a short path available (the easily readable comment) he will take it. We need to push him somehow to THINK. The best way to achieve this is to give him as little opportunities to take the short path as possible.

An example:
;*****************************************************************
;The following routine shifts a longint in r4:r5:r6:r7 right
;  by a number of bits given in A.
;A is first moved to R2, then it loops R2 times 
;  and in each loop makes one shift
;Destroys R2
;*****************************************************************
ShiftLong:
   mov   r2,a
Loop:
   mov   a,r4
   rrc   a
   mov   r4,a
   mov   a,r5
   rrc   a
   mov   r5,a
   mov   a,r6
   rrc   a
   mov   r6,a
   mov   a,r7
   rrc   a
   mov   r7,a
   djnz  r2,Loop
   ret
The lazy proofreader reads the comment (acknowledges that it describes what resources it uses - checks by eyes, yes, indeed, uses r2), then he just runs his eyes QUICKLY through the routine itself - nothing special, moves the 4 registers around and uses rrc for the shift itself. He does not need to THINK: "what-the-hell-is-it-supposed-to-do???". So he misses the error (which in fact might or might not be an error, depending on the context - but that's what the proofreader has to find out, too - or at least note the original author, that it is ambiguous).

I think there is almost never a need to proofread an isolated routine, it is always part of a - supposedly functional - program. And the proofreader knows the function of the program, the surrounding hardware; the program uses (hopefully) legible names for variables and for routines "names" (here:labels) - so he has enough clues to figure out the details fairly quickly, while he is still pushed to THINK all the time.

Btw. when using a HLL it is even easier as those tend to be self-documenting - except if it's http://www.ioccc.org/1985/august.c and alike (although check out also http://www.ioccc.org/2000/primenum.c on the same page; well this IS the real obfuscation!)

Jan Waclawek


List of 57 messages in thread
TopicAuthorDate
defensive coding how and why      Erik Malund      08/12/05 15:33      
   What do you mean?      Craig Steiner      08/12/05 17:32      
      Elegant      Steve M. Taylor      08/13/05 00:20      
         Paradox?      Rob Klein      08/13/05 05:10      
      clarification      Erik Malund      08/15/05 06:35      
         Remember      Neil Kurzman      08/15/05 11:43      
            Absolutely, and even then should be avoi      Erik Malund      08/15/05 12:19      
            Absolutely, and even then should be avoi      Erik Malund      08/15/05 12:19      
            extrodiaray?      Jan Waclawek      08/15/05 13:12      
                extrodiaray?      Craig Steiner      08/15/05 13:17      
                  Goooooogle      Jan Waclawek      08/15/05 15:08      
                     No, he does not      Erik Malund      08/15/05 15:30      
                        proofreading      Jan Waclawek      08/16/05 03:27      
                     Another challeneg      Craig Steiner      08/15/05 15:49      
                        another challenge      Jan Waclawek      08/16/05 03:45      
               OK, I can not Spell      Neil Kurzman      08/15/05 19:18      
                  this is my point      Jan Waclawek      08/16/05 03:30      
                     I sure you could, But      Neil Kurzman      08/16/05 09:35      
                        Really?      Craig Steiner      08/16/05 10:20      
                           professors and classes      Jan Waclawek      08/16/05 10:50      
                           Really !      Neil Kurzman      08/17/05 14:05      
                              Hmmm      Craig Steiner      08/17/05 14:09      
            defensive commenting      Jan Waclawek      08/16/05 03:59      
         Don't know      Craig Steiner      08/15/05 12:47      
            Ok, let me get away from that word      Erik Malund      08/15/05 13:49      
               Gotcha      Craig Steiner      08/15/05 14:44      
                  and I came to truly despise that word wh      Erik Malund      08/15/05 15:07      
                     Just like driving      Kalpak Dabir      08/17/05 20:48      
            Elegant equals...      Dan Henry      08/15/05 17:21      
               that it      Erik Malund      08/16/05 06:11      
               Oh, how true...!      Andy Neil      08/23/05 05:29      
                  It's never the author's problem      Dan Henry      08/23/05 08:51      
                     I knew a person who told me about a real      Erik Malund      08/23/05 09:38      
                        A blissful existence      Dan Henry      08/23/05 18:37      
                  Your bugs versus my bugs (or vice versa)      Dan Henry      08/23/05 18:34      
                     common wisdom has it that the average pr      Erik Malund      08/24/05 07:34      
   One exception      Ian Bell      08/13/05 08:32      
      exceptions      Erik Malund      08/15/05 06:45      
         vice versa      Jan Waclawek      08/15/05 06:53      
            what is obvious      Erik Malund      08/15/05 07:58      
               your mileage may vary      Jan Waclawek      08/15/05 08:15      
                  that is the very same      Erik Malund      08/15/05 09:05      
                     competent      Jan Waclawek      08/15/05 13:40      
                        please define "working"      Erik Malund      08/15/05 14:02      
                           competent programming => working program      Jan Waclawek      08/15/05 15:48      
   i'm new      Emem Essien      08/18/05 05:10      
      if you move your eyeballs a bit to the l      Erik Malund      08/18/05 06:22      
         Coding Bible      Russell Bull      08/20/05 08:16      
            Precedence vs. explicitness      Dan Henry      08/20/05 09:27      
   Outlaw coding!      Russell Bull      08/21/05 06:47      
      a program it is, by definition, asynchro      Erik Malund      08/22/05 07:42      
         Methinks the point was missed      Russell Bull      08/22/05 18:20      
            "Easy?"      Andy Neil      08/23/05 03:13      
            but we agree      Erik Malund      08/23/05 07:34      
      VIPER?      Andy Neil      08/22/05 10:53      
      What does "timing" mean?        Dan Henry      08/22/05 20:03      
         excuse the foreigner, if he was not clea      Erik Malund      08/23/05 07:36      

Back to Subject List