|
1 | | -# Design pattern samples in Java. |
| 1 | +<!-- the line below needs to be an empty line C: (its because kramdown isnt |
| 2 | + that smart and dearly wants an empty line before a heading to be able to |
| 3 | + display it as such, e.g. website) --> |
| 4 | + |
| 5 | +# Design pattern samples in Java |
2 | 6 |
|
3 | 7 | [](https://gitter.im/iluwatar/java-design-patterns?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) |
4 | 8 |
|
|
7 | 11 | src="https://scan.coverity.com/projects/5634/badge.svg"/> |
8 | 12 | </a> |
9 | 13 |
|
10 | | - <a name="top"/> |
| 14 | + |
| 15 | +#### Browse and view all of the patterns on our Website: [iluwatar.github.io/java-design-patterns/](https://iluwatar.github.io/java-design-patterns/) |
| 16 | + |
| 17 | +<a name="top"/> |
| 18 | + |
| 19 | +# <a name="toc">Table of Contents</a> |
11 | 20 | - <a href="#introduction">Introduction</a> |
12 | | - - <a href="#list-of-design-patterns">List of Design Patterns</a> |
13 | | - - <a href="#creational-patterns">Creational Patterns</a> |
14 | | - - <a href="#structural-patterns">Structural Patterns</a> |
15 | | - - <a href="#behavioral-patterns">Behavioral Patterns</a> |
16 | | - - <a href="#concurrency-patterns">Concurrency Patterns</a> |
17 | | - - <a href="#presentation-tier-patterns">Presentation Tier Patterns</a> |
18 | | - - <a href="#business-tier-patterns">Business Tier Patterns</a> |
19 | | - - <a href="#architectural-patterns">Architectural Patterns</a> |
20 | | - - <a href="#integration-patterns">Integration Patterns</a> |
21 | | - - <a href="#idioms">Idioms</a> |
22 | 21 | - <a href="#faq">Frequently Asked Questions</a> |
23 | 22 | - <a href="#how-to-contribute">How to contribute</a> |
24 | 23 | - <a href="#versioning">Versioning</a> |
25 | 24 | - <a href="#credits">Credits</a> |
26 | 25 | - <a href="#license">License</a> |
27 | | - |
| 26 | + |
28 | 27 |
|
29 | 28 | ## <a name="introduction">Introduction</a> |
30 | 29 |
|
@@ -38,119 +37,6 @@ Reusing design patterns helps to prevent subtle issues that can cause major |
38 | 37 | problems, and it also improves code readability for coders and architects who |
39 | 38 | are familiar with the patterns. |
40 | 39 |
|
41 | | -## <a name="list-of-design-patterns">List of Design Patterns</a> [↑](#top) |
42 | | - |
43 | | -### <a name="creational-patterns">Creational Patterns</a> [↑](#top) |
44 | | - |
45 | | -Creational design patterns abstract the instantiation process. They help make a |
46 | | -system independent of how its objects are created, composed, and represented. |
47 | | - |
48 | | -* [Abstract Factory](#abstract-factory) |
49 | | -* [Builder](#builder) |
50 | | -* [Factory Method](#factory-method) |
51 | | -* [Prototype](#prototype) |
52 | | -* [Property](#property) |
53 | | -* [Singleton](#singleton) |
54 | | -* [Step Builder](#step-builder) |
55 | | -* [Multiton](#multiton) |
56 | | -* [Object Pool](#object-pool) |
57 | | - |
58 | | -### <a name="structural-patterns">Structural Patterns</a> [↑](#top) |
59 | | - |
60 | | -Structural patterns are concerned with how classes and objects are composed to |
61 | | -form larger structures. |
62 | | - |
63 | | -* [Adapter](#adapter) |
64 | | -* [Bridge](#bridge) |
65 | | -* [Composite](#composite) |
66 | | -* [Decorator](#decorator) |
67 | | -* [Facade](#facade) |
68 | | -* [Flyweight](#flyweight) |
69 | | -* [Proxy](#proxy) |
70 | | -* [Service Locator](#service-locator) |
71 | | -* [Servant](#servant) |
72 | | -* [Event Aggregator](#event-aggregator) |
73 | | - |
74 | | -### <a name="behavioral-patterns">Behavioral Patterns</a> [↑](#top) |
75 | | - |
76 | | -Behavioral patterns are concerned with algorithms and the assignment of |
77 | | -responsibilities between objects. |
78 | | - |
79 | | -* [Chain of responsibility](#chain-of-responsibility) |
80 | | -* [Command](#command) |
81 | | -* [Interpreter](#interpreter) |
82 | | -* [Iterator](#iterator) |
83 | | -* [Mediator](#mediator) |
84 | | -* [Memento](#memento) |
85 | | -* [Observer](#observer) |
86 | | -* [State](#state) |
87 | | -* [Strategy](#strategy) |
88 | | -* [Template method](#template-method) |
89 | | -* [Visitor](#visitor) |
90 | | -* [Null Object](#null-object) |
91 | | -* [Intercepting Filter](#intercepting-filter) |
92 | | -* [Specification](#specification) |
93 | | -* [Dependency Injection](#dependency-injection) |
94 | | - |
95 | | -### <a name="concurrency-patterns">Concurrency Patterns</a> [↑](#top) |
96 | | - |
97 | | -Concurrency patterns are those types of design patterns that deal with the |
98 | | -multi-threaded programming paradigm. |
99 | | - |
100 | | -* [Double Checked Locking](#double-checked-locking) |
101 | | -* [Thread Pool](#thread-pool) |
102 | | -* [Async Method Invocation](#async-method-invocation) |
103 | | -* [Half-Sync/Half-Async](#half-sync-half-async) |
104 | | - |
105 | | -### <a name="presentation-tier-patterns">Presentation Tier Patterns</a> [↑](#top) |
106 | | - |
107 | | -Presentation Tier patterns are the top-most level of the application, this is |
108 | | -concerned with translating tasks and results to something the user can |
109 | | -understand. |
110 | | - |
111 | | -* [Model-View-Controller](#model-view-controller) |
112 | | -* [Model-View-Presenter](#model-view-presenter) |
113 | | -* [Flux](#flux) |
114 | | -* [Front Controller](#front-controller) |
115 | | - |
116 | | -### <a name="business-tier-patterns">Business Tier Patterns</a> [↑](#top) |
117 | | - |
118 | | -* [Business Delegate](#business-delegate) |
119 | | - |
120 | | -### <a name="architectural-patterns">Architectural Patterns</a> [↑](#top) |
121 | | - |
122 | | -An architectural pattern is a general, reusable solution to a commonly occurring |
123 | | -problem in software architecture within a given context. |
124 | | - |
125 | | -* [Data Access Object](#dao) |
126 | | -* [Service Layer](#service-layer) |
127 | | -* [Naked Objects](#naked-objects) |
128 | | -* [Repository](#repository) |
129 | | - |
130 | | -### <a name="integration-patterns">Integration Patterns</a> [↑](#top) |
131 | | - |
132 | | -Integration patterns are concerned with how software applications communicate |
133 | | -and exchange data. |
134 | | - |
135 | | -* [Tolerant Reader](#tolerant-reader) |
136 | | - |
137 | | -### <a name="idioms">Idioms</a> [↑](#top) |
138 | | - |
139 | | -A programming idiom is a means of expressing a recurring construct in one or |
140 | | -more programming languages. Generally speaking, a programming idiom is an |
141 | | -expression of a simple task, algorithm, or data structure that is not a built-in |
142 | | -feature in the programming language being used, or, conversely, the use of an |
143 | | -unusual or notable feature that is built into a programming language. What |
144 | | -distinguishes idioms from patterns is generally the size, the idioms tend to be |
145 | | -something small while the patterns are larger. |
146 | | - |
147 | | -* [Execute Around](#execute-around) |
148 | | -* [Poison Pill](#poison-pill) |
149 | | -* [Callback](#callback) |
150 | | -* [Lazy Loading](#lazy-loading) |
151 | | -* [Double Dispatch](#double-dispatch) |
152 | | -* [Resource Acquisition Is Initialization](#resource-acquisition-is-initialization) |
153 | | -* [Private Class Data](#private-class-data) |
154 | 40 |
|
155 | 41 | # <a name="faq">Frequently asked questions</a> [↑](#top) |
156 | 42 |
|
@@ -225,16 +111,16 @@ Flyweight. |
225 | 111 | * src (the source code of the pattern) |
226 | 112 | * index.md (the description of the pattern) |
227 | 113 | * pom.xml (the maven pom.xml) |
228 | | -3. Implement the code changes in your fork. Remember to add sufficient comments |
| 114 | +4. Implement the code changes in your fork. Remember to add sufficient comments |
229 | 115 | documenting the implementation. Reference the issue id e.g. #52 in your |
230 | 116 | commit messages. |
231 | | -4. Format the code according to [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html) |
| 117 | +5. Format the code according to [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html) |
232 | 118 | * [Eclipse configuration](https://github.com/google/styleguide/blob/gh-pages/eclipse-java-google-style.xml) |
233 | 119 | * [IntelliJ configuration](https://github.com/google/styleguide/blob/gh-pages/intellij-java-google-style.xml) |
234 | | -5. Create a simple class diagram from your example code and put it inside of the etc folder. |
235 | | -6. Add description of the pattern in index.md and link to the class diagram. |
| 120 | +6. Create a simple class diagram from your example code and put it inside of the etc folder. |
| 121 | +7. Add description of the pattern in index.md and link to the class diagram. |
236 | 122 | (Attention, all internal links must be relative to the pattern subdirectory, else the links dont link properly on the website) |
237 | | -7. Create a pull request. |
| 123 | +8. Create a pull request. |
238 | 124 |
|
239 | 125 | **Structure of the index.md file** |
240 | 126 |
|
|