**DONOTDELETE**
(Unregistered)
01/10/04 08:52 AM
Good article...but...

Love the article (as with all the design patterns ones, it's very useful).
However, isn't the Line example just an implementation of a Factory pattern - you don't actually have an unshared flyweight object.
To be a true implementation of the flyweight pattern, shouldn't you have your existing Line class holding the intrinsic state (i.e. the colour), then a FlyweightLine class which holds the end points of the line, and a reference to the shared Line object.
This would also solve the redrawing problem mentioned by someone else if you held a list of all the FlyweightLine objects.

Cheers

Jim



Contact us JavaWorld

Powered by UBB.threads™ 6.5.5

Featured White Papers


RESEARCH CENTERS: Java Standard Edition | Java Enterprise Edition | Java Micro Edition | Development Tools
About Us | Advertise | Contact Us | Terms of Service/Privacy
Copyright, 2006-2008 Network World, Inc. All rights reserved.