From 0b7892d234e88574222b17bb39174edc46d174de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilkka=20Sepp=C3=A4l=C3=A4?= Date: Sun, 24 Aug 2014 20:03:29 +0300 Subject: [PATCH] Update README.md --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index fcb6aba6f..24d470a93 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,15 @@ ##Flyweight **Intent:** Use sharing to support large numbers of fine-grained objects efficiently. +![alt text](https://github.com/iluwatar/java-design-patterns/blob/master/flyweight/etc/flyweight.jpg "Flyweight") + +**Applicability:** The Flyweight pattern's effectiveness depends heavily on how and where it's used. Apply the Flyweight pattern when all of the following are true +* an application uses a large number of objects +* storage costs are high because of the sheer quantity of objects +* most object state can be made extrinsic +* many groups of objects may be replaced by relatively few shared objects once extrinsic state is removed +* the application doesn't depend on object identity. Since flyweight objects may be shared, identity tests will return true for conceptually distinct objects. + ##Proxy **Intent:** Provide a surrogate or placeholder for another object to control access to it.