Sunday, June 3, 2018

Design patterns illustrated by Java SE/EE APIs?







Currently studying patterns stuff, and this one lacks concrete examples. Would you help me to fill missing cells in a table illustrating design patterns with concrete examples from Java 6 SE/EE APIs?




In the end I'll update this table with your contributions. Thanks.




Pattern name Illustration
-----------------------------------------------------------------------------
1 Abstract factory
2 Builder
3 Factory method java.util.Calendar.getInstance()
4 Lazy initialization
5 Object pool

6 Prototype java.util.ArrayList.clone()
7 Singleton java.lang.Runtime
8 Adapter
9 Bridge
10 Composite
11 Decorator java.io.BufferedWriter(Writer out)
12 Facade
13 Flyweight
14 Proxy
15 Chain of responsibility

16 Command
17 Interpreter
18 Iterator java.util.Iterator
19 Mediator
20 Memento
21 Null object java.util.Collections.EMPTY_LIST
22 Observer
23 Specification
24 State
25 Strategy java.util.Comparator

26 Template method
27 Visitor


EDIT: Thanks to @BalusC for pointing to his brilliant answer.

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...