Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!rpi!uwm.edu!ogicse!milton!hardy!jjb From: jjb@hardy.u.washington.edu (Jim Black) Newsgroups: comp.lang.c++ Subject: Re: C++ learning curve (Was: Re: Seeking critique(s) of C++) Keywords: C++ learning curve Message-ID: <19114@milton.u.washington.edu> Date: 27 Mar 91 20:21:15 GMT References: <1991Mar20.015750.9487@dbase.A-T.COM> <633@taumet.com> <18979@milton.u.washington.edu> <1950@news.tcs.com> Sender: news@milton.u.washington.edu Reply-To: jjb@hardy.acs.washington.edu (Jim Black) Organization: University of Washington, Seattle Lines: 65 In article <1950@news.tcs.com> gwu@nujoizey.tcs.com (George Wu) writes: >In article <18979@milton.u.washington.edu>, black@blake.u.washington.edu >(Jim Black) writes: >|> Anyway, by far the biggest criticism I would level at C++ is that it's >|> a hard language to learn - much harder than C to become expert at. > > I've heard this argument before, and I have to wonder if it's not a >matter of learning object oriented programming, rather than C++ itself. >When I was in school, data abstraction and code modularity was heavily >emphasized. There was also a smattering of object oriented programming, but >for me, only as lectures, not programming assignments. > > Anyways, I found C++ easy to learn. It came naturally. I think the >data abstract style of programming C-MU taught me is responsible for this. >Granted, C++, and object oriented programming in general, does not consist >solely of data abstraction. However, since I already think in those terms, >it's certainly one aspect of C++ which I didn't have to learn. I will >concede, however, straight C was easier to learn, but in the long run, the >(for me) only slightly extra effort to learn C++ pays off. More power to you! :-) I've always programmed using abstract data types though, at least for many years. The main complaints other programmers ever had about my code was that it was too modular :-) (eg, can't edit one big procedure that does everything). In C I emulated single-inheritance techniques using "/*must be first in struct!*/" link hacks and such. Similarly my design/interface debates with other engineers often had me insisting that the bowels of this-or-that module should be hidden (else the interface was wrong), while my colleagues were hoping to trample and snoop all over foreign structures and didn't understand why I wasted my time trying to design interfaces to preclude that. So I felt well-prepared to move into C++, and always felt that it supported programming "the way I thought it should be done" better than C. But it was still complex to learn. I don't think it's a simple a matter as getting used to "data abstraction and code modularity"... It's more the aspects of C++ such as copy/constructor/assignment/destructor semantics that took getting used to for me (get 'em all in there!), stream operator overloading... and the way the object-oriented features are built onto C rather than being chosen completely naturally has at times seemed contrived and awkward. This is the major advantage of C++ of course (the migration path from C and strong compatiblility from C), but it seems to me the major weakness at the same time (just an observation) ... sometimes the syntax is plain awkward. (Pointer to members may be the best example.) One of the things that system engineers have always had trouble with with the 286/386 protected architectures are that there are so many ways of accomplishing the same things, they spend their time arguing over which is best/appropriate ... C++ is reminiscent of that at times too. Getting things to disk and back without replication of effort and some burden on all subtypes is also something that leaves me scratching my head. Another sorespot seems to be metaclasses, or class information ... (which would help in the former problem) ... I find myself exporting prototype objects from class definitions for certain things, for this purpose. We've got a book the size of the ARM that simply discusses how C++ behaves, and somewhat informally at that. That's not PL/1-class complexity, but certainly puts C or Pascal complexity to shame. (Fine! It's a more powerful language. But still...) I'd be interested in hearing whether other participants in this group feel that C++ has a steep learning curve, too. George is the first C++ programmer I've heard say otherwise, but maybe I'm listening to the wrong people..