Skip to content

Commit d5a46be

Browse files
committed
docs: builder, business-delegate, bytecode, caching, callback, chain diagrams
1 parent 25f7bc6 commit d5a46be

12 files changed

+25
-12
lines changed

builder/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ public Hero(Profession profession,String name,HairType hairType,HairColor hairCo
4040

4141
As you can see, the number of constructor parameters can quickly become overwhelming, making it difficult to understand their arrangement. Additionally, this list of parameters might continue to grow if you decide to add more options in the future. This is known as the telescoping constructor antipattern.
4242

43+
Sequence diagram
44+
45+
![Builder sequence diagram](./etc/builder-sequence-diagram.png)
46+
4347
## Programmatic Example of Builder Pattern in Java
4448

4549
In this Java Builder pattern example, we construct different types of `Hero` objects with varying attributes.
@@ -146,10 +150,6 @@ Program output:
146150
16:28:06.060 [main] INFO com.iluwatar.builder.App -- This is a thief named Desmond with bald head and wielding a bow.
147151
```
148152

149-
## Builder Pattern Class Diagram
150-
151-
![Builder](./etc/builder.urm.png "Builder class diagram")
152-
153153
## When to Use the Builder Pattern in Java
154154

155155
Use the Builder pattern when
51.1 KB
Loading

business-delegate/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ Wikipedia says
3636

3737
> Business Delegate is a Java EE design pattern. This pattern is directing to reduce the coupling in between business services and the connected presentation tier, and to hide the implementation details of services (including lookup and accessibility of EJB architecture). Business Delegates acts as an adaptor to invoke business objects from the presentation tier.
3838
39+
Sequence diagram
40+
41+
![Business Delegate sequence diagram](./etc/business-delegate-sequence-diagram.png)
42+
3943
## Programmatic Example of Business Delegate Pattern in Java
4044

4145
The following Java code demonstrates how to implement the Business Delegate pattern. This pattern is particularly useful in applications requiring loose coupling and efficient service interaction.
@@ -145,10 +149,6 @@ Here is the console output.
145149
21:15:33.794 [main] INFO com.iluwatar.business.delegate.YouTubeService - YouTubeService is now processing
146150
```
147151

148-
## Business Delegate Pattern Class Diagram
149-
150-
![Business Delegate](./etc/business-delegate.urm.png "Business Delegate")
151-
152152
## When to Use the Business Delegate Pattern in Java
153153

154154
Use the Business Delegate pattern when
Loading

bytecode/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ In plain words
3131

3232
> An instruction set defines the low-level operations that can be performed. A series of instructions is encoded as a sequence of bytes. A virtual machine executes these instructions one at a time, using a stack for intermediate values. By combining instructions, complex high-level behavior can be defined.
3333
34+
Sequence diagram
35+
36+
![Bytecode sequence diagram](./etc/bytecode-sequence-diagram.png)
37+
3438
## Programmatic Example of Bytecode Pattern in Java
3539

3640
In this programmatic example, we show how the Bytecode pattern in Java can simplify the execution of complex virtual machine instructions through a well-defined set of operations. This real-world example demonstrates how the Bytecode design pattern in Java can streamline game programming by allowing wizards' behavior to be easily adjusted through bytecode instructions.
23 KB
Loading

caching/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ Wikipedia says
3434

3535
> In computing, a cache is a hardware or software component that stores data so that future requests for that data can be served faster; the data stored in a cache might be the result of an earlier computation or a copy of data stored elsewhere. A cache hit occurs when the requested data can be found in a cache, while a cache miss occurs when it cannot. Cache hits are served by reading data from the cache, which is faster than recomputing a result or reading from a slower data store; thus, the more requests that can be served from the cache, the faster the system performs.
3636
37+
Flowchart
38+
39+
![Caching flowchart](./etc/caching-flowchart.png)
40+
3741
## Programmatic Example of Caching Pattern in Java
3842

3943
In this programmatic example, we demonstrate different Java caching strategies, including write-through, write-around, and write-behind, using a user account management system.

caching/etc/caching-flowchart.png

44.4 KB
Loading

callback/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ Wikipedia says
3737

3838
> In computer programming, a callback, also known as a "call-after" function, is any executable code that is passed as an argument to other code; that other code is expected to call back (execute) the argument at a given time.
3939
40+
Sequence diagram
41+
42+
![Callback sequence diagram](./etc/callback-sequence-diagram.png)
43+
44+
4045
## Programmatic Example of Callback Pattern in Java
4146

4247
We need to be notified after the executing task has finished. We pass a callback method for the executor and wait for it to call back on us.
40.6 KB
Loading

chain-of-responsibility/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ Wikipedia says
3535

3636
> In object-oriented design, the chain-of-responsibility pattern is a design pattern consisting of a source of command objects and a series of processing objects. Each processing object contains logic that defines the types of command objects that it can handle; the rest are passed to the next processing object in the chain.
3737
38+
Flowchart
39+
40+
![Chain of Responsibility flowchart](./etc/chain-of-responsibility-flowchart.png)
41+
3842
## Programmatic Example of Chain of Responsibility Pattern
3943

4044
In this Java example, the Orc King gives orders which are processed by a chain of command representing the Chain of Responsibility pattern. Learn how to implement this design pattern in Java with the following code snippet.
@@ -159,10 +163,6 @@ Orc officer handling request "torture prisoner"
159163
Orc soldier handling request "collect tax"
160164
```
161165

162-
## Chain of Responsibility Pattern Class Diagram
163-
164-
![Chain of Responsibility](./etc/chain-of-responsibility.urm.png "Chain of Responsibility class diagram")
165-
166166
## When to Use the Chain of Responsibility Pattern in Java
167167

168168
Use Chain of Responsibility when
Loading

0 commit comments

Comments
 (0)