Newsgroups: alt.lang.design,comp.lang.c++,comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!pipex!uunet!ncrgw2.ncr.com!ncrhub2!ncr-sd!lcpd2!elsegundoca.ncr.com!swf
From: swf@elsegundoca.ncr.com (Stan Friesen)
Subject: Re: Comparing productivity: LisP against C++ (was Re: Reference Counting)
Message-ID: <D16Ho3.4BE@lcpd2.SanDiegoCA.NCR.COM>
Sender: news@lcpd2.SanDiegoCA.NCR.COM (News Administrator)
Nntp-Posting-Host: tools3.elsegundoca.attgis.com
Reply-To: swf@elsegundoca.ncr.com
Organization: NCR Teradata Database Business Unit
References: <19941203T221402Z.enag@naggum.no> <LGM.94Dec5075553@polaris.ih.att.com> <D0CLt9.6K3@research.att.com> <BUFF.94Dec15103904@pravda.world> <D0xAIp.3Dn@rheged.dircon.co.uk> <vrotneyD11MDv.Ks7@netcom.com> <D14LKq.4CJ@lcpd2.SanDiegoCA.NCR.COM> <vrotneyD15A7u.4IM@netcom.com>
Date: Wed, 21 Dec 1994 20:45:38 GMT
Lines: 67
Xref: glinda.oz.cs.cmu.edu comp.lang.c++:104452 comp.lang.lisp:16139

In article <vrotneyD15A7u.4IM@netcom.com>, vrotney@netcom.com (William Paul Vrotney) writes:
|> >
|> >   This is certainly NOT going to get the most effective use out of C++.
|> 
|> Who cares?  My main concern is to get the program working, not half working
|> with lots of gotchas and memory leaks.  I've seen too many C++ programs in
|> this state.  I'm wide open to suggestions as how to get the most effective
|> use out of C++.

Well, start with using a C++ style library, and then design your
solution to make effective use of that library.

Since it is being included in the standard, the STL is a good choice.
This is a very general library with a large number of different containers,
iterators, and many, many algorithms *using* said containers.

If you need matrix manipulation, there are commercial matrix libraries
for C++.  (And indeed, general math libraries).

You will get far more effective use of C++ using STL than using a
Lispish library that does much the same sorts of things.

Memory leaks are relatively easy to deal with if you use a proper
constructor/destructor based resource allocation scheme. In most
cases a resource, such as memory, should be allocated in the constructor(s)
for a class, and released in the destructor.  Even if it is not possible
to put the allocation in the constructors, the destructor should *always*
release it.

|> >   Effective C++ programming style requires a different approach than
|> >   Lisp programming - the best solution of a given problem is often
|> >   different in the two languages.
|> 
|> I think that I've tried this "C++ programming style" that you speak of and I
|> don't like it.  I've read some of the C++ books.  If I had to characterize
|> it I would say that this style (if I'm hearing you) is too static, and I
|> have to go way out of my way to write extraneous code to support this static
|> style, which introduces all sorts bugs and obscurities.  That's why I've
|> changed to a more Lispy programming style.  I find that it is quite
|> effective.

This sounds as if you never did quite learn how to use it appropriately.
The static *type* system is a very powerful debugging tool, if used
properly, and not bypassed.

But, to do this you first need to design your system so that it is
compatible with this approach.  The design phase is critical.  In
general, if you find yourself needing to "program around" the type
system, you are probably using the wrong design for C++.

Or, by "static" do you mean something else? [Certainly, dynamic lists
and the like are quite easily handled in C++, even polymorphic ones,
so I cannot see that you would mean that].

|> Well, I'm telling you from experience that the Formal Design approach for
|> the kinds of problem that I mention is going to fail you.  You can sit in a
|> room and formally design all you want but you are not going to get anywhere
|> until you get some visualization of your data world.

There are lots of ways to do this, using existing tools and methods.
Once the visualization phase is complete, then go to the analysis
phase, and then the design phase.  *Then* start coding.

-- 
swf@elsegundoca.attgis.com		sarima@netcom.com

The peace of God be with you.
