Re: [gtk-list] Re: ANNOUNCE: Experimental C++ Wrapper




Howdy!

On Sun, 2 Jan 2000, Dean Johnson wrote:

> Howdy all,
> Just thought I would throw in my $0.02 worth. I love C++, its just C++
> programmers that I can't stand ;o). I have been on projects that have
> gone way out of control in a helluva hurry because of the abuse of C++.
> Those projects failed miserably. As a result of those failures and my
> desire to use C++ on Gtk related projects I have created the following
> policies for myself and others working on my projects. Enjoy!
> 
> I think I will duck back in my bunker for safety.
> 
> 	-Dean Johnson
> 
> ------------------------------------------------------------------------
> 
> 
> Use a fairly strict subset of C++ for clarity
> and support issues. The coding style is more like C with some good and
> non-arcane features in C++. This is to placate the anti-C++ forces that
> swirl around in the vortex known at GNOME, whose complaints about lack
> of maintainability of C++ code are quite well informed and hardened by
> experience.
> 

No. Use a C++ style of coding with both C and C++. I have leared how to
write nice C readable code by writing C++ code.

> THOU SHALT NOT USE...
> 
>         * Templates. They are evil and not well supported on many
>           debuggers.

On the other hand, using templates give less code, and thus less code to
make errors in, if used right. However, I think you should
avoid making templates with the preprocessor in C :-).


> 
>         * Exceptions. These are rarely supported well in any debugger.
>           They are also a crutch for poor design and destroy the clean
>           lines through the codes.

On the other hand, right use of exeptions give you correct error messages
and less needs for a debugger.

> 
>         * Overloaded operators. This creates code that is incredibly
>           hard to read

Hmm ...

> 
> Thou shalt...
> 
>         * Have a destructor for every constructor that does an
> allocation.
> 

Yes.

>         * Use polymorphisms for clarity and elegance.
> 

Yes.

>         * Use default arguments to reduce typing.
> 
> 

Don't think so, but know I probably have to duck.

Most important "Thou shalt..." : If you change old code, follow the coding
convention used in that code.

>                 ------------------------------------------------
>                 NOTE:   Any "THOU SHALT NOT"'s detected will be
>                         summarily removed without warning.
>                 ------------------------------------------------
> 

David Pettersson, spammer.




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