home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / ada / 3710 < prev    next >
Encoding:
Text File  |  1992-12-16  |  2.3 KB  |  57 lines

  1. Newsgroups: comp.lang.ada
  2. Path: sparky!uunet!usc!sdd.hp.com!cs.utexas.edu!asuvax!ennews!enuxha.eas.asu.edu!koehnema
  3. From: koehnema@enuxha.eas.asu.edu (Harry Koehnemann)
  4. Subject: Re: FORTRAN bug(was Re: C++ vs. Ada -- Is Ada loosing?)
  5. Message-ID: <1992Dec16.164712.20051@ennews.eas.asu.edu>
  6. Followup-To: comp.lang.ada
  7. Sender: news@ennews.eas.asu.edu (USENET News System)
  8. Reply-To: koehnema@enuxha.eas.asu.edu (Harry Koehnemann)
  9. Organization: Arizona State University
  10. References: <1992Dec11.132942.24054@mksol.dseg.ti.com> <1992Dec11.163811@lglsun.epfl.ch> <1992Dec14.183326.27689@newshost.lanl.gov>
  11. Date: Wed, 16 Dec 1992 16:47:12 GMT
  12. Lines: 43
  13.  
  14. In article <1992Dec14.183326.27689@newshost.lanl.gov> jlg@cochiti.lanl.gov (J. Giles) writes:
  15. >|> Michael Feldman:
  16. >|>    ...
  17. >|>    x = 1;
  18. >|>    while (x <= 10);
  19. >|>    { 
  20. >|>       printf("%d\n", x);
  21. >|>       x++;
  22. >|>    }
  23. >Without explicitly looking for the above type of error, or having
  24. >an automated tool which looks for it on your behalf, this could be
  25. >a difficult to find error.  The problem is that programmers look
  26. >at code and *know* what it's supposed to do.  They tend to skim
  27. >the code looking for glaring errors. They miss this sort of thing
  28. >because it's next to invisible.
  29.  
  30. But, that skimming process is a good thing -  it's a way of using
  31. abstraction.  I don't concern myself with the details of each statement,
  32. rather I abstract out the function of a set of statements.  Another
  33. problem is that a programmer is usually thinking in terms of the problem
  34. domain rather than in terms of the language, which makes it harder
  35. to locate these little language flukes.  Abstraction is an important
  36. tool, but can stab you in the back when you're not looking.
  37.  
  38. I've seen the above example on many exams and have always had mixed
  39. emotions about it.  Sure it tests the knowledge of the language, but
  40. it's not encouraging the abstraction concepts taught in the class and
  41. may actually be counterproductive.
  42.  
  43. Another great test question:
  44.  
  45.     i = 1;
  46.     while (i <= 10)
  47.         printf("%d\n");
  48.         i++;
  49.  
  50. What's the output?  The indentation is a pattern we recognize and it's
  51. easy to "skim" over it and assume we understand something we don't.
  52.  
  53. For what it's worth.
  54. --
  55. Harry Koehnemann            Arizona State University
  56. koehnema@enuxha.eas.asu.edu        Computer Science Department
  57.