Re: Code guidelines, state of C++ compilers used, and generalC++comments


Subject: Re: Code guidelines, state of C++ compilers used, and generalC++comments
From: sam th (sam@bur-jud-118-039.rh.uchicago.edu)
Date: Tue May 09 2000 - 15:00:48 CDT


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 9 May 2000, Mike Nordell wrote:

> >So what's your suggestion? Make them all private, and create
> >inline accessor functions?
>
> Yes. To write e.g. 'getHwnd()' instead of 'm_hWnd' is no great burden for
> the increase in maintainability it gives. Should one in the future decide
> to replace that mechanism by something else, the baseclass is free to do
> whatever refactoring it wants to. Derived classes should only depend on
> their baseclasses public and protected _interfaces_, not their
> implementation-specifics.
> When designing interfaces there's one principle that's really good to
> think about:
> - Interfaces shall be small and complete.
> (I don't think "small" was the word I was looking for, but it works)
>
> If someone feels the need to probe a baseclass' data directly, perhaps
> that baseclass' interface isn't "complete".

Well, I would like to support Mike on this one. If you all think back to
the libpng bug, it was caused by accessing a piece of data directly,
instead of through an accessor function. Then the data structure changed,
and AbiWord broke. All we had to do to fix it was behave like good
programmers and use the provided function. I'd prefer not to see this
kind of bug internally in AbiWord.
           
                                     sam th
                                     sam@uchicago.edu
                                http://sam.rh.uchicago.edu
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.1 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE5GG5yt+kM0Mq9M/wRAnWqAJ9YoRYwiRtD1xQQNcaSpZ12wDm5LwCgrT73
N5qeK3nbbmz0WYGm0rUSMC0=
=1hHm
-----END PGP SIGNATURE-----



This archive was generated by hypermail 2b25 : Tue May 09 2000 - 15:00:51 CDT