gauchy/DesignPatterns
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
#Design pattern examples 1 Observer 2 Startegy - for changing the behavior at run time. 3 Decorator - coffee example 4 Decorator2 - gui component example 5 FactoryMethod - Car example 6 AbstractFactory - Windows button example (Main diff between FactoryMethod and AbstractFactory is that AbstractFactory is completely interface driven.) 7 Command - When similar kind of execution has to be done from a single place then use command pattern...Universal Remote control example 8 Command2 - Todo : Example on network crashing...it is using other patterns like singleton and observer. 9 Singleton - Threadsafe singleton needs double nullability check...."http://javarevisited.blogspot.in/2011/06/volatile-keyword-java-example-tutorial.html" explains the importance of volatile. 10 Adapter pattern - It is similar to Decorator where we wrap an object but the difference is in the intent.In Adapter pattern the intent is to make a class adapted to particular requirement.(Example of cat adapting to Lion interface) 11 Facade Pattern - It is similar to Adapter and Decorator but again the intent is different , Its job is to expose a simpler interface to the user hiding complex details...example is of starting a movie or programming over a computer. 12 Template method- Its nothing but interaction between abstract and concrete...No example 13 Iterator -Main purpose of Iterator pattern is to iterate over collection without exposing its implementation. 14 Composite - The composite pattern is any tree kind of structure where from child another tree can start...For eg : the DOM is also a composite object...therefore from the body to the innermost divs and components we can create a composite object...TODO DOM example time and will permitting. 15 State pattern - Example of Delhi metro turnstile.