Friday 11 January 2019

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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...