Re: Java "interface" vs. OO interface

From: Joe \ (joe_at_bftsi0.UUCP)
Date: 11/22/03


Date: Sat, 22 Nov 2003 13:05:21 -0800


"Dave Harris" <brangdon@cix.co.uk> wrote in message <news:memo.20031122193107.1792A@brangdon.m>...

> tgm2tothe10thpower@hotmail.replaceTextWithNumber.com (Thomas G. Marshall)
> wrote (abridged):
> > > Indeed, to qualify access is arguably to break encapsulation;
> >
> > You have the cart utterly before the horse. Encapsulation is what
> > requires you to use qualified access. Not "to qualify access
> > is arguably to break encapsulation." That is simply false.
>
> Why?
>
> The encapsulation idea is that a derived class should be insulated from
> its ancestor classes; all except its immediate parent. Using qualified
> names is a way of reaching past its immediate parent to its parent's
> parent. If the class hierarchy is changed so that a constant is now taken
> from a different class, the derived class must change.
>
> I suspect your problem is as others have suggested: a lack of good tools
> to tell you which ancestor class a name comes from.

If a class has a parent(s) and/or implements interfaces, perhaps
inherited names should be qualified with the name of the parent
or interface. A name from (say) parent X could collide with one
from interface Y, and you'll need some way to disambiguate. No
reaching past the immediate parent(s) though, otherwise avoiding
the Fragile Base Class problem would become much more difficult.

--
Joe Foster <mailto:jlfoster%40znet.com>     On the cans? <http://www.xenu.net/>
WARNING: I cannot be held responsible for the above        They're   coming  to
because  my cats have  apparently  learned to type.        take me away, ha ha!


Relevant Pages

  • Re: [GIT PULL] DRBD for 2.6.32
    ... reusing the kernel RAID ... what's much more important is the user interface. ... A 'block device' like 'sda' has a parent in sysfs, ... representing dependencies: The child is dependent on the parent. ...
    (Linux-Kernel)
  • Handling flags on vlan(4)
    ... Presently our vlandriver sets interface's flags to 0 initially ... interface is attached to its parent. ... if you assign IP to vlan before attaching the latter to ...
    (freebsd-net)
  • Re: Handling flags on vlan(4)
    ... Y> interface is attached to its parent. ... if you assign IP to vlan before attaching the latter to ... GLEBIUS-RIPN GLEB-RIPE ...
    (freebsd-net)
  • Re: Nslookup problem
    ... is this for the external or internal interface? ... as parent folder) is not a valid host name" click OK to create the record ... "Listen on" on the interface tab and stop the (same as parent folder) ...
    (microsoft.public.windows.server.dns)
  • Re: MFC and c++ problems
    ... You say that a control must make no assumptions about its parent. ... messages to its parent will compile and run ... ... One could write an interface class that supported the methodneeded by ...
    (microsoft.public.vc.mfc)