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