home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / msdos / programm / 11674 < prev    next >
Encoding:
Internet Message Format  |  1992-12-29  |  4.2 KB

  1. Path: sparky!uunet!meaddata!ralpht
  2. From: ralpht@meaddata.com (Ralph W. Trickey)
  3. Newsgroups: comp.os.msdos.programmer
  4. Subject: Re: Newbie Wants Advice on C-Programming
  5. Date: 29 Dec 1992 14:09:31 GMT
  6. Organization: Mead Data Central, Dayton OH
  7. Lines: 85
  8. Distribution: world
  9. Message-ID: <1hpm6rINNs97@meaddata.meaddata.com>
  10. References: <1992Dec23.220530.15347@netcom.com> <1992Dec24.172333.7339@grebyn.com> <1992Dec25.070024.15672@grebyn.com> <1992Dec27.031157.27179@mole-end.matawan.nj.us>
  11. NNTP-Posting-Host: retina.meaddata.com
  12.  
  13. In article <1992Dec27.031157.27179@mole-end.matawan.nj.us>, mat@mole-end.matawan.nj.us writes:
  14. |> In article <1992Dec25.070024.15672@grebyn.com>, malak@grebyn.com (Michael Malak) writes:
  15. |> > In article <1hdpluINN1lv@agate.berkeley.edu> faustus@ygdrasil.CS.Berkeley.EDU (Wayne A. Christopher) writes:
  16. |> > >In article <1992Dec24.172333.7339@grebyn.com> malak@grebyn.com (Michael Malak) writes:
  17. |> 
  18. |> > >> ...  I feel the following must be learned in order:
  19. |> > >>   1) Pascal, with two semesters experience
  20. |> 
  21. |> > >IMHO, Pascal has nothing useful that C doesn't have, except for array
  22. |> > >bounds checking.  You you use C++ you can use a vector class that
  23. |> > >gives you that.
  24. |> 
  25. |> > Pascal has the following advantages over C:
  26. |> >    1) It has structured syntactic blocks for constants, types and
  27. |> >       variables.
  28. |> 
  29. |> This is no advantage.
  30. |> 
  31. |> A program is a model: an abstraction expressed in a representation.  The
  32. |> Pascal seperation of constant, type, and variable classifies the tools of
  33. |> representation; it is irrelevant within a program.  Would you require a
  34. |> cook to measure out all the ingredients specified by tablespoons before
  35. |> measuring any ingredient specified by cups?
  36. |>  
  37.  
  38. The MS-DOS Pascals I have worked with allow more than one of each type
  39. of block. You can have a type, followed by a const, followed by
  40. another type.
  41.  
  42. |> >    2) It has nested procedures.
  43. |> 
  44. |> True to a point.  See Kernighan's _Why Pascal is not my Favorite Programming
  45. |> Language_ for the limitations of nested procedures.
  46. |>  
  47. |> >    3) Most importantly, the good structured programming professors
  48. |> >       wouldn't be caught dead teaching C (biggotry in my opinion).
  49. |> 
  50. |> Besides which, people who learn Pascal first seem to take three or four
  51. |> times as long to learn how to use C pointers as people who don't learn
  52. |> Pascal at all, and Pascal introduces people to some really poor
  53. habits.
  54.  
  55. Could you explain why that might be? I see no difference between
  56. pointers in Pascal and pointers in C. Could it be that the people that
  57. were using Pascal were fresh out of college, as opposed to people that
  58. had been programming professionally for a while?
  59.  
  60. |> 
  61. |> The classical Pascal expression of a loop-and-a-half cannot be written
  62. |> as a while() because Pascal's expression syntax is too weak.  It cannot
  63. |> be written as a loop-and-a-half because Pascal doesn't allow a `break'
  64. |> from a loop.  What results is a circumlocution involving more code in
  65. |> control flow and temporary variable managing than in solving the problem;
  66. |> worse, one branch of an  if-then  is related to the circumlocution and
  67. |> one to the problem to be solved.  This is a very bad form of incohesion:
  68. |> 
  69. |>     if not X
  70. |>         manage the loop
  71. |>     else
  72. |>         solve the problem
  73. |> 
  74. |> This seems to me as damaging to potential software designers as BASIC
  75. |> is claimed to be to potential programmers.
  76.  
  77.   That was solved that a long time ago, simply create another nested
  78. procedure that contains the loop, and exit from the nested procedure
  79. to exit from the loop.
  80.  
  81.   In addition I believe that Metaware Pascal has had break
  82. statements for at least the last 4 years (also iterators). Borland
  83. Pascal 7.0 now includes break and continue statements.
  84.  
  85.   I will agree that ISO standard pascal would be a poor method of
  86. learning, but take a look at a modern Pascal, like Borland's Pascal
  87. 7.0. It bears the same resemblance to ISO Pascal, that C++ bears to C.
  88. It even has single inheritance.
  89.  
  90.  
  91. -- 
  92. Ralph Trickey       | (513) 865-6800                  |        
  93. Mead Data Central   | x4870                           |  Disclaimer
  94. P.O. Box 933        | ralpht@meaddata.com             |  My opinions are my own
  95. Dayton, Ohio  45401 | ...!uunet!meaddata!ralpht       |
  96.  
  97.  
  98.