Newsgroups: comp.lang.c++,comp.lang.smalltalk,comp.object
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!uunet!rcm!rmartin
From: rmartin@rcmcon.com (Robert Martin)
Subject: Re: C++ Productivity
References: <1995Jan23.193745.7044@boole.com> <jim.fleming.84.00133AB6@bytes.com> <1995Jan25.201226.28856@rcmcon.com> <jim.fleming.75.0003AF13@bytes.com> <3gls1u$p2l@osfa.aber.ac.uk> <1995Feb1.184049.16332@rcmcon.com> <D3E33s.DCp@da_vinci.ecte.uswc.uswest.com>
Organization: R. C. M. Consulting Inc. 708-918-1004
Date: Fri, 3 Feb 1995 17:24:03 GMT
Message-ID: <1995Feb3.172403.2977@rcmcon.com>
Lines: 134
Xref: glinda.oz.cs.cmu.edu comp.lang.c++:110782 comp.lang.smalltalk:20312 comp.object:26070

tblanch@lookout (Todd Blanchard) writes:

>Here, perhaps is the point.  The C++ language is entirely too large and
>complex.  

Certainly it is large and complex.  But not "too large" nor "too
complex".  If it were, then it would not be selling as well as it is.
You can claim that the purchasers don't really know what they are
buying, but that is a pretty weak argument.

>It is *hard* to use correctly.  

Yes, C++ is hard to use correctly.  So is Smalltalk.  So is Pascal.
So is C.  So is any computer language.  Why?  Because software is
hard.

If you are saying that C++ is harder to use than other languages, I
agree to a point.  There are projects for which the C++ learning curve
could not be justified.  However, for large, industrial projects, C++
provides tools which pay back the learning curve.  For these kinds of
projects, C++ is finally easier to use than many other languages would
be. 

>It takes at *least* two years
>for a person to become expert at its use.  

6 months is more in line with my experience, and that of my
associates.

>If you are not expert, you are not likely to be successful.  

I think this is unfounded.  I know of several projects where the
programmers were new to C++, and yet managed to create successful
projects. 

>C++ code is not fault tolerant.  

This is a broad statement.  It needs to be clarified.  Certainly you
can write code whose behavior is undefined.  In many environments,
undefined behavior includes the potential for complete system crash.
In other environments, undefined behaviors are trapped and reported.
There are environments that will even halt the program and display the
line of source code that created the undefined behavior.  

However, C++ is relatively good about reporting compile time errors,
and in finding most of the obvious mistakes that would create
undefined behaviors.  So I and my associates do quite well with C++'s
current "fault tolerance" features.  

>Of the people who have used OO languages coming to C++, they are not
>used to being so close to the hardware and their lives are fraught with
>dangerous memory management and type conversion problems.  

This is certainly true of some of them.  Others, of course, have had
the necessary experience and do not find it alien.  In any case,
saying that "their lives are fraught with dangerous memory management
and type conversion problems" is an overstatement.  Certainly people
who are not used to memory mangement struggle with it for awhile.  But
when it comes down to it, memory management is no different from any
other kind of resource management.   (Note.  This is not a blast upon
GC.  I like GC).

As for type conversions, yes, it takes a while to get used to strong
typing.  However the benefits are significant.  Many of us prefer to
use strongly typed languages.  In the end, one learns how to design
software without the need for lots of type conversions.

>If they come
>from a C background, they do not properly use the OO capabilities.

THis is an extremely strong statement, and is quite inaccurate.  C
programmers are not, as a class, ignorant of OO.  Certainly there are
some C programmers who don't know OO, but there are others that do.
Those that don't will learn how to do OOD and OOP if they try.  

>Now I don't know about you, but the average person I meet is simply not
>that bright.  And it takes a *very* bright person to become expert at
>using C++.  

It takes a very bright person to design software.  Anybody that can
create a credible software design will find C++ trivial in comparison.

>C++ is not an evil language, but it is not for the masses.

No computer language is for the masses.   Not even Basic.

>That C++ is so hard to use correctly *is* a weakness of the language.
>The language is too big, too much code gets called unexpectedly.  A
>perfect example is a program where I had to inherit from a vender
>supplied class.  The class had a const char* operator.  I thought this
>would get used when I said:

>cout << myObject << endl;

>It was, sort of but my object was first copied onto the stack, then
>converted.  The vender code was not copy safe and had pointer based
>memory.  The app went down in flames and I spent 2 days figuring this
>out.  This happens all the time in wonderful C++. 

Certainly this happens.   That it happens "all the time" is contrary
to my experience.  Yes, there are "gotchas" in C++.  There are
"gotchas" in any language.  Yes, you have to be careful with the
assumptions you make.  Yes, you have to be careful when using third
party code.  But these cares are not limited to C++.

In other languages, you might not have had the vendor supplied code at all.

>The language attempts to do too much, type conversion and copying go on
>all the time, usually without the knowledge of the programmer.  

Only if the programmers supplies the conversion operators.  And if he
does, then let it be on his head to be aware of when they will be
used.

>Why does
>the compiler write a copy constructor and op= for everything?  This
>feature alone is most likely responsible for hours of grief.

Once you learn the language, this ceases to be a problem.  You code
your own copy constructor and assignment operator unless you are
absolutely sure that the once provided will be appropriate.

>In my experience, C++ costs more, takes longer, and is much less
>dependable than C because of all of the unexpected little behaviors.

In my experience, C++ has allowed me to create designs that are
reusable and maintainable, and to greatly reduce the development
effort on significant projects.

-- 
Robert Martin       | Design Consulting   | Training courses offered:
Object Mentor Assoc.| rmartin@rcmcon.com  |   Object Oriented Analysis
2080 Cranbrook Rd.  | Tel: (708) 918-1004 |   Object Oriented Design
Green Oaks IL 60048 | Fax: (708) 918-1023 |   C++
