Hi
For any of you that own a copy of GOF book, on page 38 there is a
class diagram showing the Glyph hierarchy. Two questions
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.
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()...
If I am right then how can we resolve the issue without
overcomplicating the design.
Kind Regards
Merlin 4 1308
On 19 May 2004 11:20:16 -0700, me********@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
In article <j8********************************@4ax.com>,
Mitchell <cheeliang_@_iname_._com> wrote: On 19 May 2004 11:20:16 -0700, me********@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.
I don't think this is a good idea. What does it mean to insert a glyph
into, say, a Rectangle, or a Character? Glyph should only have methods
that *all* sub-types can implement (even if it is a null
implementation.) 'Insert' is not such a method.
Daniel T. wrote: Mitchell wrote: "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.
I don't think this is a good idea. What does it mean to insert a glyph into, say, a Rectangle, or a Character? Glyph should only have methods that *all* sub-types can implement (even if it is a null implementation.) 'Insert' is not such a method.
Guys, take the GOF book, and take out the "word processor" sample
application. Now put in an application which you thought of. That
application must show every pattern, and use only familiar and accessible
concepts.
The OP has detected a point where the "word processor" sample application
may fall down. There may be more. However, the ultimate arbiter would be the
actual implementation of this hypothetical application.
--
Phlip http://industrialxp.org/community/bi...UserInterfaces
> Hi For any of you that own a copy of GOF book, on page 38 there is a class diagram showing the Glyph hierarchy. Two questions
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.
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()...
If I am right then how can we resolve the issue without overcomplicating the design.
Kind Regards
Merlin
If I've got the right end of the stick, if you refer to page 166 of
the implementation section for composite it discusses the tradeoffs,
safety v transparency, of declaring Insert in the base component class
or not, GoF "emphasize transparency over safety" in the examples. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Davide M3xican Coppola |
last post by:
Hi, I would realize an interface (interface) for a pair of concrete
classes (concrete & concrete2), but I have a problem because I have to
access to a third class (element) and if I try to declare...
|
by: Pol Bawin |
last post by:
A class has a private field of type IWizard (An interface) and a public
property to access it.
When I try to serialize the Geometry class in XML, i have an error but it
works in Binary
Can...
|
by: Stephan Rose |
last post by:
Ok here is my scenario
I have an interface called IScalar which describes a one dimensional
number that has a certain unit of measurement.
This interface is used to create multiple structures,...
|
by: Ole Hanson |
last post by:
I am accessing my database through an interface, to allow future
substitution of the physical datastore - hence I would like to declare in my
Interface that my DAL-objects implementing the...
|
by: jon |
last post by:
How can I call a base interface method?
class ThirdPartyClass :IDisposable { //I can not modify this class
void IDisposable.Dispose() {
Console.WriteLine( "ThirdPartyClass Dispose" );
}
}
...
|
by: LS |
last post by:
Can a WebMethod return an Interface type?
Can we pass an interface parameter ?
Example :
public interface IEntity
{
long Id { get; set; }
string Name { get; set; }
}
|
by: masoud bayan |
last post by:
I've come across something in Interface implementation that I am not sure is
correct behavior in VB.NET (and maybe C#) or not?
Consider following example:
Public Interface IShape
|
by: stefan.moser |
last post by:
Hi All,
I'm having a problem implementing the Separated Interface pattern from
Martin Fowler's book Patterns of Enterprise Application Architecture.
I'm using C# in Visual Studio 2005.
The...
|
by: YellowFin Announcements |
last post by:
Introduction
Usability and relevance have been identified as the major factors
preventing mass adoption of
Business Intelligence applications. What we have today are traditional
BI tools that...
|
by: WTH |
last post by:
I am now aware (I am primarily a C++ developer) that in C# if you reference
the same interface from the same file in two different projects the types
are actually incompatible.
I found this out...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |