This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes OO, Patterns, UML and Refactoring and the fly likes flyweight pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "flyweight pattern" Watch "flyweight pattern" New topic
Author

flyweight pattern

abalfazl hossein
Ranch Hand

Joined: Sep 06, 2007
Posts: 635
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!





 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: flyweight pattern
 
Similar Threads
flyweight pattern
Chap5: Strings and Flyweight
difference between Flyweight and Singleton Pattern
Java Heap Space Error, OutofMemory Exception while writing large data to excel sheet.
flyweight pattern