From: mbk@lyapunov.ucsd.edu (Matt Kennel)
Newsgroups: comp.object
Subject: Re: Maintenance and OO
Date: 26 Jan 1993 08:03:30 GMT
Organization: Institute For Nonlinear Science, UCSD
NNTP-Posting-Host: lyapunov.ucsd.edu
X-Newsreader: Tin 1.1 PL3

pkeddie@axion.bt.co.uk (Paul Keddie) writes:
: I know that, in theory, the benefits OO gives to developers should also
: count for maintainers (data hiding, etc) -- but does this bare up in
: practise? Specifically:
: <deleted>
: 3) Are there more difficulties because of C++ rather than the 00 paradigm?
: 4) Is badly written C++, 00 programs worst than the equivalent C programs?

I don't have that much experience with C++ except to say that I
think it's revolting.  It inherits (ahem) many of the flaws from C but
then proceeds to combine them exponentially.

In my opinion, C++ is way too hard for humans to parse.  I think many people
have problems just figuring out the *literal* meaning of C++ programs(like
APL), rather than the underlying content.  That's an utterly needless loss
of productivity.  C++ helps for some things, but the real bugs are orders of
magnitude more difficult.  The "random memory stomp bug" of C turns into
fire-breathing Mothra.  

OO programming without garbage collection is difficult and dirty.

Personally, I like Sather much, much better.  Even with an early
preproduction compiler (0.2), I'm 2 to 3 times more productive than with
C.  And it runs as fast as C++.  The entire documentation for the 
(early version) language and compiler is 25 pages.

I've been rewriting many of my science programs in Sather for a couple of
months now.  I've never felt the need to use the debugger. Best
experience---I wrote 2000 lines or so "cold" at the beginning.  This was the
bare minimum setting up all the classes before I could get anything
reasonable to run. Once I got it to compile, I ran it once, and got a
checked run-time error.(line# and file).  The bug was trivial to fix.  I
recompiled, and reran and the damn thing worked perfectly. "I'm not
worthy! I'm not worthy!" :-)

In any case, there are lots of "low-brow" items that I think C++
blows completely that make a big difference in productivity.  For
example, you can compile Sather programs with run-time checking, so that
it is *impossible* to core-dump or stomp random memory.  (factor of 2
in speed, I'd say) This has saved me in minutes from bugs that would take
hours to find in C, and other bugs that are probably still hiding in
my programs.

The benefits of garbage collection can also hardly be overstated.
How much of real C++ class libraries is devoted to figuring out exactly
when to allocate and deallocate, and when who's allowed to assign to what?
Ever have a dangling pointer to previously freed memory?  Doesn't happen
with GC.

There are other languages that have great advantages over C++.  Some
may even be efficient, c.f. Modula-3.  (I think I"ll still like
Sather better though).

: I think that is enough for now, thanks in advance for your comments
: 
: Paul
: Software Maintenance Group, Software Technology Division, BT
: Research Labs, Martlesham Heath, Ipswich, IP5 7RE, UK
: E-mail:  pkeddie@axion.bt.co.uk
: Phone:  +44 473 649154
: Fax:    +44 473 643019 

--
-Matt Kennel  		mbk@inls1.ucsd.edu
-Institute for Nonlinear Science, University of California, San Diego
-*** AD: Archive for nonlinear dynamics papers & programs: FTP to
-***     lyapunov.ucsd.edu, username "anonymous".