Bookmark Topic Watch Topic
  • New Topic

flyweight pattern  RSS feed

 
abalfazl hossein
Ranch Hand
Posts: 635
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi!



http://www.developer.com/design/article.php/3677501

If I use the flyweight pattern so that I only store unique Time instances, I can reduce the maximum number of typical time objects to 96 (24 hours times four possible times per hour). The appointment application will still support odd times, but predictable use suggests that flyweight will dramatically minimize object creation and memory usage.

When we use flyweight we share common data between objects,Which data in these objects iin this example are similar that he share?


May you give me a simple example by code about flyweight?
Thanks in advance!





 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place. Please read this for more information.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!