Re: GOF Interface Problem
From: Mitchell (cheeliang__at__iname_._com)
Date: 05/29/04
- Next message: Ken: "Re: Help with class contract"
- Previous message: Robert C. Martin: "Re: singleton vs static"
- Next in thread: Daniel T.: "Re: GOF Interface Problem"
- Reply: Daniel T.: "Re: GOF Interface Problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 29 May 2004 11:01:43 +0800
On 19 May 2004 11:20:16 -0700, merlin2769@hotmail.com (Merlin) wrote:
>Am I right to say that Image(or Graphic) would be another class that
>should inherit from Glyph in order to follow from Fig 2.2 and Fig 2.3
>on the previous page.
Anyway, this is OT. You might wish to try comp.object for more ideas.
I have helped to cross post to comp.object.
For example, page 38 says
"We can treat text and graphics uniformly with respect to how they are
drawn, formatted, and embedded within each other."
Page Page 36 says
"we should treat text and graphics uniformly"
"lets the user embed text within graphics freely and vice versa"
So yeah, I understand Image/Graphic as derived from Glyph.
>Secondly, why does Glyph have Insert() operation in its interface if
>only some of the classes that inherit from it need this operation. The
>interface for Glyph should be all the operations common to the classes
>that derive from it. I have come across the ISP priciple by Robert C.
>Martin that says this is a bad thing and designers should segregate
>the interface and use multiple inheritance. The Glyph interface has
>been polluted by Insert()...
"lets the user embed text within graphics freely and vice versa"
So I understand they were planning to let you embed graphics in text,
thus the text glyphs (character, etc) will need the Insert method.
Also, since it is a hierarchy of classes, with only the classes at the
bottom of the hierachy being non-decomposable/not made up of other
glyphs, it makes sense to let classes all inherit from a base class
Glyph. Otherwise, different classes in the hierachy will need to
inherit from multiple different classes (so as to include and exclude
certain interfaces like Insert), creating a rather messy hierachy.
Cheers
- Next message: Ken: "Re: Help with class contract"
- Previous message: Robert C. Martin: "Re: singleton vs static"
- Next in thread: Daniel T.: "Re: GOF Interface Problem"
- Reply: Daniel T.: "Re: GOF Interface Problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|