Xref: utzoo comp.lang.c++:8439 comp.software-eng:3927 Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sunybcs!boulder!agcsun!marks From: marks@agcsun.UUCP (Mark Shepherd) Newsgroups: comp.lang.c++,comp.software-eng Subject: Re: Project experience with C++ Keywords: real-life, project experience, C++ Message-ID: <814@agcsun.UUCP> Date: 14 Jul 90 17:30:00 GMT Organization: Ampex VSD Golden Engineering, Golden, CO Lines: 146 Hi. I recently posted a request for information from people who had real-life long-term experience with a substantial C++ project. I received replies from five people who have actual project experience (5-10 people, tens to hundred of K lines of code). Here's a compilation of what they said (different paragraphs are from different respondents): - how long does it take an C or Pascal programmer to learn and become productive in object-oriented design and programming Not sure. We had been using Lisp and were pretty rusty in C before we moved to C++. I'd guess not too long to get productive, but you'll need someone with experience to review designs. I expect it takes a year or so before it all really sinks in. We plunged in after a couple of months and did ok, but we have had to go back and revise a lot of things. It takes about 2-3 months to learn C++ if someone knows C (or Pascal). However, it takes about six months to a year to LEARN the paradigm shift to OOP. After 2-3 months, there aren't any more "tricks" or syntax to learn, other people's code is "readable", ... Defining objects, concentrating on WHAT vs HOW, avoiding procedural traps (especially with respect to error recovery), takes considerable time; up to a year. - how long does it take to develop something in C++ compared to C Can't say. If you really need the stuff that C++ provides, it would make a BIG difference. If you don't know what to do with inheritance or virtual member functions, it'll probably slow you down. Once beyond the initial learning cycle, no extra time, but see below [comment on designing with an eye towards re-use]. - how good is the long-term extendability, reliability, maintainability of object-oriented designs/implementations Seems ok so far. Like C, it's really up to you. It's as easy to write a nightmare in C++ as it is in C. If there is a decent library, then OOP designs/implementations tend to have excellent long-term extendability, reliability, and maintainability. I have one design that I have reused for several years, now, and some code that is only re-linked as classes are upgraded. The trick is to concentrate on the analysis and design phases with an eye towards REUSE; i.e., a usefull library. - what are the pros/cons of doing a project in C++ rather than C Definitely use C++ over non-ansi C. Also, if you have people who understand object oriented programming, you'll want to use C++. Since C++ interfaces to C fairly well, you don't give up much to use C++. Compiler and debugger quality and stability has been the major con so far. If you don't have people who understand OO, I wouldn't bother with it. If you're used to using something powerful, like Sabre-C, wait till they come out with Sabre-C++. If you're used to inadequate debuggers that lie to you or simply don't tell you much, you'll feel right at home. If coding in C+ (i.e., traditional programming, not OOP, but using the C++ compiler), the project is usually worse off because of the difficulty in training/readability, ... (programmers tend to get enamored of the cute syntax available and throw it all in :-) - what are the pitfalls of doing something in C++ Executable size explosion. This may go away. Include file saturation--10 line .cc files sometimes require 10K lines of .h. Deluding yourselves that you are doing OOP. Not enough GOOD environments around; e.g., decent SOURCE debuggers, browsers, on-line entity dictionaries, ... [editor's note: Saber-C++ is due to be released late this year. Cross your fingers...] - is C++ particularly well suited (or badly suited) to - graphic user interfaces (X/Motif) Yes, provided you are willing to invest the time and effort to convert the header files to C++ (actually, jointly compatible with C using the #ifdef __cplusplus or separate directory ...) Sure. Look at the rave reviews InterViews gets (IV is a publicly available X library/toolkit). I don't know of a package for Motif though. Everyone hopes that somebody will build it on top of IV. [editor's note: Solbourne has recently introduced a C++ object library that works for either Motif or OpenLook. I can't (yet) comment on how good it is.] - real time device control I have been controlling telephone switches and line interface units with no problems. After all, it is really C that you are using underneath, and C has been used for these purposes quite successfully for years. - other comments ? We have a group doing a project in C++. It seems the C++ crowd cannot seem to get anything completed within schedule. (P.S. Please do not post my response, it would not go over well with my management.) [editor's note: how about if I paraphrase and then leave out your name.] My immediate experience in a project with about 5 programmers is that there is a tendency of people starting out with C++ to try to use the language in ways that are not really object-oriented; ie, they'll just convert all their structures to objects. Another problem is going too gung-ho and making a somewhat obscure object mechanism central to the project, thus slowing it down. The moral is, if most of the group are novices, be very selective about where and how the language extensions are used. On the other hand, there is another project within my company which started out with more OO people and had more time to do education and spec-writing (OOD). This one seems to have gone rather well, last I heard. It was more like 10 people, 100K lines. [The theoretical benefits of C++] are definitely achieved in practice, PROVIDED you have a review of any new classes; i.e., reward reuse!!! Concentrate on the library, and communicate the library. This latter point is where an on-line entity dictionary (even simple hypercard can suffice) really shines. Imagine you need a "car" object. It would be nice to know that there was already an "automobile" object in the library, just waiting to be reused... - any published literature on this subject ? There was a workshop at last year's OOPSLA conference on the use of OOP in commercial environments. While not totally directed at the use of C++, many attendees had experience in using this language. There is a report (~30 pages) which reports what the attendees had to say about thier use of OOP. [editor's note: if you're interested, send me a surface mail address. and I'll ship you a copy, as soon as I get it.] There's an article in the USENIX 1988 C++ Conference C. Berman and R. Gur, "NAPS -- A C++ Project Case Study", pp. 137-152. Another interesting article is in March 1989 Uniforum: E. Flanagan, "Experiences in Using C++ in Large Projects". An article on the impact of C++ and OOP on the maintenance of a system by Dennis Mancl of AT&T Bell Laboratories will appear this November in the IEEE Conference on Software Maintenance. Thanks to all who responded. I hope this compilation is useful to everyone out there. Mark Shepherd agcsun!marks