home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / mac / system / 10369 < prev    next >
Encoding:
Text File  |  1992-07-25  |  4.4 KB  |  82 lines

  1. Newsgroups: comp.sys.mac.system
  2. Path: sparky!uunet!cs.utexas.edu!sdd.hp.com!ux1.cso.uiuc.edu!m.cs.uiuc.edu!coolidge
  3. From: coolidge@cs.uiuc.edu (John Coolidge)
  4. Subject: Re: Windows NT (Not a flame.) and C++ comments
  5. Message-ID: <1992Jul25.000155.17005@m.cs.uiuc.edu>
  6. Sender: news@m.cs.uiuc.edu (News Database (admin-Mike Schwager))
  7. Reply-To: coolidge@apple.com
  8. Organization: A/UX Enabling Technologies - OS Group, Apple Computer, Inc.
  9. References: <1992Jul21.124631.8584@msc.cornell.edu> <1992Jul21.192200.18180@tamsun.tamu.edu>
  10. Date: Sat, 25 Jul 1992 00:01:55 GMT
  11. Lines: 69
  12.  
  13. bpb9204@tamsun.tamu.edu (Brent) writes:
  14. >maynard@esther.msc.cornell.edu (Maynard J. Handley) writes:
  15. >| We hear about how great object-orientation is (and I
  16. >|agree completely- I now shudder at the thought of coding in anything but
  17. >|C++) but what does object-orientation for OS get you, that a decent C++ API
  18. >|to a traditional OS does not?
  19.  
  20. >You are right, OOP is a good thing, but its features certainly can't be
  21. >used for everything.  I'd personally shudder at writing a UNIX C compiler
  22. >in C++.  What would the objects be?  Would they be function definitions?
  23.  
  24. I personally shudder at the thought of people writing large software
  25. systems without doing most of the design analysis required when writing
  26. object-oriented software, whatever language is used for the resulting
  27. code. If you write your C compiler in C, you still have to figure out
  28. what your data structures are. What's the difference?
  29.  
  30. >would have other statement objects?  Yes, you could write it in C++ without
  31. >using all the object stuff, but the basic compilation process is too 
  32. >algorithmically intensive to bother with objects.  The ++ overhead would
  33. >slow down numerous method calls (the way C++ objects are implemented).
  34.  
  35. Objects are wonderful when designing algorithmically intensive code,
  36. because they give you a place to encapsulate your algorithms and allow
  37. you to replace them without heavy rewrites. Also, there is no difference
  38. in the overhead of a C++ (non-virtual) function call and a C function
  39. call, so if you're not doing polymorphic functions there's no cost. On
  40. the other hand, if you're doing function calls through pointers in C,
  41. that'll cost you the same as virtual function calls in C++. Ditto for
  42. switch() statements. Both are harder to maintain than C++ classes.
  43.  
  44. >These above questions are exactly what I asked a fellow classmate in my
  45. >compiler design class.  We had to write a Pascal compiler using whichever
  46. >system we wanted.  I did it straightforwardly in C, and he talked about doing
  47. >it in C++.  He didn't turn in a working project.  This has two interpretations:
  48. >either the C++ realm was not fit for the project, or his programming skills
  49. >weren't fit for the project.  I personally think it was a combination of
  50. >the two; he had heard how great C++ is for everything and that he was trying
  51. >to make it work, but couldn't get it going.  I think this is more the case
  52. >because of what I know about him.  However, I'll never know for sure.
  53.  
  54. Funny, I had almost the same situation in my compiler class. The prof
  55. even handed out code fragments and data structures in C. Several of us
  56. decided to write the compiler in C++ instead. Note: this was my first
  57. semester using C++, and my second doing OOP (Smalltalk the previous
  58. semester). All of us finished much more quickly than the people using C;
  59. all of us experienced far fewer bugs and produced better code.
  60.  
  61. OOP (languages and design techniques) are _not_ a silver bullet, as one
  62. set of extremists claim. However, they are also _not_ slow and
  63. inefficient, nor are they only suited to a few niche-market tasks, as
  64. the reactionaries claim. I think my graduate advisor was on the right
  65. track when he said "OOP conferences will be a short-lived phenomina.
  66. Within a few years, OOP will just be another tool that all CS people
  67. have and use daily. The idea of an OOP conference will look as silly in
  68. a few years as a structured programming conference looks now."
  69.  
  70. I agree. I wouldn't attempt to do a large system without using
  71. structured programming techniques, and I shudder at the work of those
  72. who do. The same is true for OOP.
  73.  
  74. --John
  75.  
  76.         May the forces of evil become confused on the way to your house.
  77.                 -- George Carlin
  78.  
  79. +++John L. Coolidge++++++++++++++++coolidge@apple.com+++++++++++++++++++++++
  80. I speak for myself, not for Apple Computer. Copyright 1992 John L. Coolidge.
  81. Copying allowed only if attributed, and if all copies may be further copied.
  82.