Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Mar 2002 22:16:02 -0500
From:      Brian T.Schellenberger <bts@babbleon.org>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        Kenneth Culver <culverk@alpha.yumyumyum.org>, "Steve B." <steveb99@earthlink.net>, "Eugene L. Vorokov" <vel@bugz.infotecs.ru>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: C vs C++
Message-ID:  <20020306031602.A86B4BA03@i8k.babbleon.org>
In-Reply-To: <3C856C7F.5005E30E@mindspring.com>
References:  <20020305132457.A4700-100000@alpha.yumyumyum.org> <20020305214127.545FDBA03@i8k.babbleon.org> <3C856C7F.5005E30E@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday 05 March 2002 08:10 pm, Terry Lambert wrote:
 | "Brian T.Schellenberger" wrote:
| > On Tuesday 05 March 2002 03:26 pm, Terry Lambert wrote:
| > > Kenneth Culver wrote:
| > > > Why are you being so sarcastic? Everyone here is assuming that it's
| > > > harder to write C++ code, so you should only use it if necessary. It
| > > > isn't necessary to use it for something like a daemon.
| > >
| > > Because that underlying assumption is false, and I'm making
| > > fun of it.
| >
| > Reality check:  How can you possibly contend that it is no more difficult
| > to write code in a language which *so* much more massive?
|
| It's not "*so* much more massive".  Hardly anyone who wants
| to write understandable code uses operator overloading, unless
| the are definiing a "String" or "ImaginaryNumber" class, and
| then it's incredibly clear-cut what's going on.
|
| The "private" vs. "public" is incredibly useful for data
| hiding, as well as namespace seperation.  It means you
| can't spam values accidently, if you can't spam them on
| purpose.
|
| If you have a hard time with "default private", then use
| "struct" instead of "class" for declaring things, and the
| default will be "public" instead.
|
| The "protected" and "friend" features are seldom used; if
| you understand FORTRAN mutual recursion as a means of
| implementing recursion in FORTRAN, which doesn't support
| it by default, then you understand "friend" functions.
|
| Inheritance is logical, to anyone who has ever programmed
| in the FreeBSD networking stack or VM system, both of which
| use structure casts to implement inheritance, whether you
| want it or not.
|
| Multiple inheritance is like "protected"... for the most
| part, you can ignore it.

In other words it *is* so much more massive but most of that is junk and can 
be safely ignored.

We would be in agreement there but it still gets in the way of learning it.

| > And one, I might add, which is intentionally UNdesigned.
|
| Yeah, and ANSI-C has prototypes because the compiler vendors
| were too damn lazy to change their object format to include
| a third field in the symbol table so that the problems that
| prototypes catch at compile time could be caught at link-time.

Have you ever *read* Stroustup's philosophy that a language should not have a 
philosophy?  This is precisely what's wrong with C++, and what I mean by 
UNdesigned.  It's deliberate!  Stroustup considers it a virtue!

I beg to differ.

| The hidden reason for ANSI-C prototypes, of course, is, and
| always has been, "so that C code could be compiled with a C++
| compiler, with the intent that the C++ language supercede the
| C language".
|
| So now, I expect you to vehemently protect the existance of
| ANSI-C prototypes at every future opportunity.

Prototypes are a good idea, and they did come from C++.  I never said that 
C++ was devoid of good ideas; I just think it has _too_many_ ideas.

| C++ was designed, but the design was constrained by the C
| language, just as the design of ANSI-C was constrained by
| the C language.

Mostly it was constrained by a lack of constraint.  Upward compatibility is a 
problem, but needn't be deadly.

I happen to do the majority of my programming in a C-based OO language, but 
it's not C++.  Actually, it's proprietary but it's closely modeled on 
Objective C, which is a much better OO language IMHO.

| > C++ is a language which I really liked until I really started
| > to learn about it.
|
| Well, there's a "ringing" condemnation.
|
| Have you looked at the source code for libXt or libXm
| lately?  Ah, the beauty of pure C code, applied to the
| Object Oriented programming model...

I have, and it's not real pretty.  But if bad code condemned C++ I think 
you'd have a lot more to answer for--indeed, I believe you've rejected 
precisely this logic in arguing against others.

Ok, you're in love with C++ but it's *not* the be-all and end-all of 
programming languages.  Actually I think it's a crock of unmentionability, 
but that's just me.

| Object oriented programming is not some mystery, it's a means
| of solving problems that are best modeled by abstracting
| implementation details complexity into objects, so that you
| can concentrate on writing the code, and not on the details
| of the implementation.

True . . .

| It's also a way of enhancing code reusability, through the
| use of design patterns.  Once you've written one binary
| search, you've written them all.

True . . .

| If you understand functional decomposition, then you
| unsertand the most fundamental tenet of object oriented
| programming already.

I write in OO all the time, though I admit that I feel pretty feel to cheat 
where it makes the problem easier to solve & express.  And I admit that 
sometimes I've cheated where it *didn't* in order to meet deadlines, and that 
I've almost always regretted.

But OO != C++.


| Can we all move on to something more useful, like criticizing
| Java?

Hmm . . . a little pot - kettle thing going on there, is there?



|
| -- Terry

-- 
Brian T. Schellenberger . . . . . . .   bts@wnt.sas.com (work)
Brian, the man from Babble-On . . . .   bts@babbleon.org (personal)
                                ME -->  http://www.babbleon.org
http://www.eff.org   <-- GOOD GUYS -->  http://www.programming-freedom.org 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020306031602.A86B4BA03>