Re: some comments about our C++ code...


Subject: Re: some comments about our C++ code...
From: Dom Lachowicz (cinamod@hotmail.com)
Date: Thu Apr 19 2001 - 19:15:08 CDT


Paul wrote:
> >I don't think that it should be a must to fix "the standard".
> >If all we agree (and it seems that we agree) that having
> >public/protected variables or public virtual methods is bad,
>
>Actually, we don't all agree. Not yet. As mentioned, I've been perfectly
>happy with the existing practice. I was one of the people who -- right or
>wrong -- collectively chose to write several hundred thousand LOC that way.
>I may be wrong on some or all of this, but so far I see no need to make
>this
>change.

Well, public/protected variables in a *class* are bad. Use accessor
functions with appropriate scope and parameter types. In C++, use structs if
you want this behavior, but please consider why you're using a struct
instead of a class. Please don't add functions to structs though.
ctors/dtors are fine (and preferred), though. UT_RGBColor should be a struct
under these rules and not a class, for instance.

Public virtual methods are fine. It just means that a subclass can override
them. Java does this for free. C++ does not, so you have to explicitly mark
them yourself. Think of the distinction between interface vs. data and the
fact that someone else might want to usefully subclass your public class. If
you don't want anyone to subclass you, take the appropriate steps to see
that this doesn't happen. Take the time to give appropriate scope to your
methods, especially your accessor methods. Please give appropriate scope to
all methods in your class. It's worth taking the time to do things correctly
the 1st time. Really :-)

>However, if it's important enough to others that they're willing to make
>the
>current sources compliant with the proposed standard, then I'll stay out of
>their way. Gladly.

The task is not impossible or not-worthwhile. It's just daunting.

<snip>

>Then we disagree. For me a standard is a standard, period, or else it's
>worthless.
>If this one isn't important enough to fix, then it shouldn't be a standard.

100% agree. Here, I'm for a "all new code gets written to the new standard
while we transition out the old standard." The govm't does exactly this with
its laws on say, refrigerants. CFCs have been banned, but if you're using
them in a current system, you're granted immunity for N time to transition
to the new standard. You're not exactly in violation, but you won't be able
to get anything new done to you.

Dom
motto: don't sacrifice current quality just because your older product might
not have been of the same standard

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com



This archive was generated by hypermail 2b25 : Thu Apr 19 2001 - 19:15:14 CDT