[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: "dselect" replacement team



On 11 Apr 1997, Mark Eichin wrote:

> 
> > There is only one compelling reason to ever choose C, and this is if you
> > do not know C++, or the people who are going to be using your code do not
> 
> Well, there are others.
> 	1) if you know C++ *too* well :-)

Well, that's debateble, I've been using it for about 4 years now and I
find it very usefull, much preferable to straight C.

> 	2) if you want portable code (C is a standardized language;
> C++ won't even *have* a standard for at least another 6 months, and
> who knows how long it is before the vendors catch up)

Depends what you mean by portable, sure the standard is a moving target,
but I have C++ code that compiles on 5 compilers and 4 platforms, there
is not a single major ifdef in any of this code. Some minor ones to bring
in specific compiler things (min/max) and 1 to deal with O_BINARY not
existing in unix. 

If you use exceptions namespaces and rtti then your code is hard to port
C++, if you stick to the basics, templates and classes it's not a problem
in my experiance. This of course depends on the application. 

> Only 1 and 2 apply here, of course.  And it is possible for

I'd say only 1, if dpkg/dselect is ever ported it will more than likely be
to a platform with gcc and gcc will be used to compile it, that is enough
to pretty much kill #2.

> individuals (and *maybe* small groups) to write good C++ if it's
> planned out in advance.  (I used to be enthusiastic about it too; that
> was 7 years ago...)

This is so true, but not just for C++, any large project has to have one
person that decides how it will be structured, C++ does a job of exposing
weak design and other signs of 'bad code'. C isn't any easier to make
'good code' it's just harder to make a distinction between what is good
and bad, and perhaps the difference isn't quite as extreme.

I like C++ because I usually can sense when I'm taking a wrong turn with
my class design or code because difficult to write stuff isn't 'simple',
procedures start getting huge etc. When I start to get that feeling I step
back and think about what went wrong and then fix it. C doesn't give quite
the same level of feedback for me at least.

> > traditional C programers can realtively easially make use of a C++ class
> > library without a very big learning curve.
> 
> As long as those programmers aren't doing the *design* you have a
> chance.  C++ is subtle, can hurt you on large projects (ie. anything
> with more than a basically straight inheritance graph...)

Dselect/dpkg is NOT a large project thankfully, I can see maybe 6-7
classes to start with in the base set, none of them directly realated.

It's really just alot of UI design, the current base dpkg/dselect only
seems to be in the 10k line range.

Jason


Reply to: