Re: [Libxmlplusplus-general] coding style issues
- From: murrayc t-online de (Murray Cumming)
- To: libxml++ <libxmlplusplus-general lists sourceforge net>
- Subject: Re: [Libxmlplusplus-general] coding style issues
- Date: 31 Jan 2003 18:02:35 +0100
On Fri, 2003-01-31 at 17:53, Stefan Seefeld wrote:
> Murray Cumming wrote:
> > On Fri, 2003-01-31 at 17:13, Stefan Seefeld wrote:
> >
> >>3) hiding state in the private section:
> >> It's a matter of good encapsulation to put all members into the
> >> private section, and then provide accessors (either public or
> >> protected). That helps to decouple dependencies between base and
> >> derived classes. Of course, derived classes then can't access the
> >> member variable. That's exactly the point, that's the goal !
> >
> >
> > And I say "you can't predict the future" so you should not completely hide complex types.
>
> that is a very dangerous argument, at least when applied in general:
> What if my wrapper acts as a proxy, or serializes access (making the API
> thread-safe), etc. ? This totally defeats the whole point of
> encapsulation.
> That said, the question really needs to be addressed case by case.
Sometimes you need to expect some sense from people deriving classes.
It's also very frustrating to say "make all member data private" and
then discover that you would have to break the base class's API to
achieve something new. As this is not "a proxy, or serializes access" I
don't see the need to pretend that we can predict the future.
--
Murray Cumming
murray usa net
www.murrayc.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]