home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / ada / 3220 < prev    next >
Encoding:
Text File  |  1992-11-08  |  4.0 KB  |  84 lines

  1. Newsgroups: comp.lang.ada
  2. Path: sparky!uunet!ukma!wupost!crcnis1.unl.edu!news.unomaha.edu!cwis!troj
  3. From: troj@cwis.unomaha.edu (Kevin Trojanowski)
  4. Subject: Re: The Obfuscated Ada Contest (was Re: An admittedly biased ...)
  5. Message-ID: <troj.721090131@cwis>
  6. Sender: news@news.unomaha.edu (UNO Network News Server)
  7. Organization: University of Nebraska at Omaha
  8. References: <SRCTRAN.92Oct18132621@world.std.com> <1992Oct19.165603.16988@nntpd2.cxo.dec.com> <1992Oct22.080735.19815@intrepid.com>
  9. Date: Fri, 6 Nov 1992 22:48:51 GMT
  10. Lines: 72
  11.  
  12. gary@intrepid.com (Gary Funck) writes:
  13.  
  14. >I'll close with a couple of questions:
  15.  
  16. >  - Are some/all of the above practices common to the Ada projects
  17. >    you've worked on? If, yes, what's your take?  Did such coding practices
  18. >    really improve understanding and maintaining the program?
  19.  
  20. In the group of people I work with, we have a myriad variety of styles, even
  21. though we have a published "Ada standard" we're supposed to follow.  One of the
  22. worst, in my mind, things people are doing in their code is preceding every
  23. variable name with "The_".  Thus, you have statements assigning to record
  24. componenets like this:  The_Box.The_Left_Side.The_Color
  25.  
  26. To me, that's NOT readable.  In addition, it's very annoying to have to type
  27. when working on the code.  What's wrong with:  Box.Left_Side.Color or something
  28. similar?
  29.  
  30. We also run into the case of variable names which are 30+ characters long,
  31. or so it seems.  I agree that using variables such as X, Y, K, I, J, etc
  32. can be hard to maintain, but so can code where the average identifier is
  33. 15+ characters long!
  34.  
  35. There are also compromises made in the "pass the world" notion.  Some 
  36. packages do this, some do not -- we had to allow global variables in some
  37. code, as we're dealing with X-Windows, and thus the Ada code isn't always
  38. in "control".  X-Callbacks basically force you to use global variables.
  39. There's a time and a place for everything.  Sometimes, globals are best,
  40. sometimes passing as parameters is best -- to me, to try to force it into
  41. rigid rules is a mistake, and produces hard to follow, and hard to maintain
  42. code.
  43.  
  44. >  - Are the programming practices described above unique to Ada? 
  45. >    I ask because I've seen a pattern in the "production" Ada code that
  46. >    I've read; each program runs along the lines outlined above.
  47. >    The C code that I've worked on had other problems, but long names,
  48. >    rigid structure, and unnecessary levels of abstraction
  49. >    weren't among them :-).
  50.  
  51. I've not seen them anywhere else...  In addition, we have a myriad collection
  52. of one-line procedures; the tendency to produce them seems to come from the
  53. programming ideas people are perceiving to go along with Ada.  While yes,
  54. the compiler SHOULD optimize the calls into inline code, there's no
  55. guarantee that it will.  In addition, one-line procedures are harder to follow
  56. when tracing through the code to try to track down a problem.
  57.  
  58. >and a concern:
  59.  
  60. >  - If the only Ada programs that a new graduate/new hire/new Ada programmer
  61. >    saw were by obscured "encrypted" naming conventions, rigid structure,
  62. >    and poor performance, I'd be seriously concerned that Ada would
  63. >    take the rap, when it is only the messenger.
  64.  
  65. >dissenting/confirming opinions welcome,
  66.  
  67. >- Gary
  68.  
  69. >-- 
  70. >| Gary Funck              gary@intrepid.com  [uunet!uupsi!intrepid!gary]
  71. >| Intrepid Technology Inc., Mountain View CA (415) 964-8135
  72. >--
  73.  
  74.  
  75. -------------------------------------------------------------------------------
  76. -                                   "She had what it took: great hair, a      -
  77. - Kevin Trojanowski                  profound understanding of strategic lip  -
  78. - Internet: troj@cwis.unomaha.edu    gloss, the intelligence to understand    -
  79. -      CI$: 70521,312                the world and a tiny secret interior     -
  80. - US Snail: 1905 Thurston Ave, #8    deadness which meant she didn't care."   -
  81. -           Bellevue, NE 68005                            -Douglas Adams      -
  82. -                                                          _Mostly Harmless_  -
  83. ------------------------------------------------------------------------------- 
  84.