Please join us at the new JavaWorld Q&A Forums. Your existing login will work there. The discussions here are now read-only.


JavaWorld Talkback >> 958324

Pages: 1
Anonymous
Unregistered




Good article...but...
      #5290 - 01/10/04 08:52 AM

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


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 1 anonymous users are browsing this forum.

Moderator:   

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 5873

Rate this topic

Jump to

Contact us JavaWorld

Powered by UBB.threads™ 6.5.5