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


Subject: Re: some comments about our C++ code...
From: Joaquín Cuenca Abela (cuenca@celium.net)
Date: Sun Apr 15 2001 - 14:36:11 CDT


Aaron Lehmann wrote:
>
> You're right on everything, except for:
>
> On Sun, Apr 15, 2001 at 05:16:31PM +0200, Joaqu?n Cuenca Abela wrote:
> > 3) Please, please, please: NO public/protected variables. Period. Try
> > to avoid public virtual members, too.
> > This one need a bit of collaboration from everybody. I will not go
> > through all the code and fix that. It should be fixed in an incremental
> > way with the help of everybody.
>
> This is crazy. Why is using foo->get_bar() better than foo->bar other
> than adding complexity and obfuscating the code?

implementation details always should be in the private block.
variables are always an implementation detail.
so, variables always should be in the private block.

Of course, these little rules are not exhaustive rules of OOD!, and
maybe get/set pairs are nearly so bad as a public variable in some
places, but you should remember that a public/protected variable is
*ALWAYS* bad design.

motto: Do your best designing your class' API, and don't show your guts.

Cheers,

--
Joaquín Cuenca Abela
cuenca@celium.net



This archive was generated by hypermail 2b25 : Sun Apr 15 2001 - 14:36:16 CDT