Skip to content

Commit 0509fab

Browse files
committed
docs: diagrams for callback, circuit breaker, client session, collecting parameter, colletion pipeline, combinator, command, commander, component, composite entity, composite view, composite, context object, converter, crtp, currying
1 parent d5a46be commit 0509fab

31 files changed

+60
-1
lines changed

callback/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ Sequence diagram
4141

4242
![Callback sequence diagram](./etc/callback-sequence-diagram.png)
4343

44-
4544
## Programmatic Example of Callback Pattern in Java
4645

4746
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.

circuit-breaker/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ Wikipedia says
3333

3434
> Circuit breaker is a design pattern used in modern software development. It is used to detect failures and encapsulates the logic of preventing a failure from constantly recurring, during maintenance, temporary external system failure or unexpected system difficulties.
3535
36+
Flowchart
37+
38+
![Circuit Breaker flowchart](./etc/circuit-breaker-flowchart.png)
39+
3640
## Programmatic Example of Circuit Breaker Pattern in Java
3741

3842
This Java example demonstrates how the Circuit Breaker pattern can manage remote service failures and maintain system stability.
Loading

client-session/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ Wikipedia says
3333

3434
> The client-server model on Wikipedia describes a system where client devices request services and resources from centralized servers. This model is crucial in web applications where client sessions are used to manage user-specific data across multiple requests. For example, when a bank customer accesses online banking services, their login credentials and session state are managed by the web server to maintain continuity of their interactions.
3535
36+
Sequence diagram
37+
38+
![Client Session sequence diagram](./etc/client-session-sequence-diagram.png)
39+
3640
## Programmatic Example of Client Session Pattern in Java
3741

3842
The Client Session design pattern is a behavioral design pattern that maintains a user's state and data across multiple requests within a web application, ensuring a continuous and personalized user experience. This pattern is commonly used in web applications where user-specific data needs to be managed across multiple requests.
Loading

collecting-parameter/README.md

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

3737
> In the Collecting Parameter idiom a collection (list, map, etc.) is passed repeatedly as a parameter to a method which adds items to the collection.
3838
39+
Flowchart
40+
41+
![Collecting Parameter flowchart](./etc/collecting-parameter-flowchart.png)
42+
3943
## Programmatic Example of Collecting Parameter Pattern in Java
4044

4145
Within a large corporate building, there exists a global printer queue that is a collection of all the printing jobs that are currently pending. Various floors contain different models of printers, each having a different printing policy. We must construct a program that can continually add appropriate printing jobs to a collection, which is called the collecting parameter.
Loading

collection-pipeline/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ Wikipedia says
2929

3030
> In software engineering, a pipeline consists of a chain of processing elements (processes, threads, coroutines, functions, etc.), arranged so that the output of each element is the input of the next; the name is by analogy to a physical pipeline. Usually some amount of buffering is provided between consecutive elements. The information that flows in these pipelines is often a stream of records, bytes, or bits, and the elements of a pipeline may be called filters; this is also called the pipe(s) and filters design pattern. Connecting elements into a pipeline is analogous to function composition.
3131
32+
Flowchart
33+
34+
![Collection Pipeline flowchart](./etc/collection-pipeline-flowchart.png)
35+
3236
## Programmatic Example of Collection Pipeline Pattern in Java
3337

3438
The Collection Pipeline is a programming pattern where you organize some computation as a sequence of operations which compose by taking a collection as output of one operation and feeding it into the next.
Loading

combinator/README.md

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

3636
> A combinator is a higher-order function that uses only function application and earlier defined combinators to define a result from its arguments.
3737
38+
Flowchart
39+
40+
![Combinator flowchart](./etc/combinator-flowchart.png)
41+
3842
## Programmatic Example of Combinator Pattern in Java
3943

4044
In software design, combinatory logic is pivotal for creating reusable and modular code components. By leveraging higher-order functions, the Combinator pattern promotes code reuse and maintainability in Java applications.
29.5 KB
Loading

command/README.md

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

3535
> In object-oriented programming, the command pattern is a behavioral design pattern in which an object is used to encapsulate all information needed to perform an action or trigger an event at a later time.
3636
37+
Sequence diagram
38+
39+
![Command sequence diagram](./etc/command-sequence-diagram.png)
40+
3741
## Programmatic Example of Command Pattern in Java
3842

3943
In the Command pattern, objects are used to encapsulate all information needed to perform an action or trigger an event at a later time. This pattern is particularly useful for implementing undo functionality in applications.
52.7 KB
Loading

commander/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ In plain words
3333

3434
> The Commander pattern turns a request into a stand-alone object, allowing for the parameterization of commands, queueing of actions, and the implementation of undo operations.
3535
36+
Sequence diagram
37+
38+
![Commander sequence diagram](./etc/commander-sequence-diagram.png)
39+
3640
## Programmatic Example of Commander Pattern in Java
3741

3842
Managing transactions across different services in a distributed system, such as an e-commerce platform with separate `Payment` and `Shipping` microservices, requires careful coordination. Using the Commander pattern in Java for transaction coordination helps ensure data consistency and reliability, even when services experience partial failures.
65.7 KB
Loading

component/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ In plain words
3030

3131
> The component design pattern provides a single attribute to be accessible by numerous objects without requiring the existence of a relationship between the objects themselves.
3232
33+
Architecture diagram
34+
35+
![Component architecture diagram](./etc/component-architecture-diagram.png)
36+
3337
## Programmatic Example of Component Pattern in Java
3438

3539
The `App` class creates a demonstration of the use of the component pattern by creating two different objects which inherit a small collection of individual components that are modifiable.
51.8 KB
Loading

composite-entity/README.md

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

3737
> Composite entity is a Java EE Software design pattern and it is used to model, represent, and manage a set of interrelated persistent objects rather than representing them as individual fine-grained entity beans, and also a composite entity bean represents a graph of objects.
3838
39+
Flowchart
40+
41+
![Composite Entity flowchart](./etc/composite-entity-flowchart.png)
42+
3943
## Programmatic Example of Composite Entity in Java
4044

4145
For a console, there may be many interfaces that need to be managed and controlled. Using the composite entity pattern, dependent objects such as messages and signals can be combined and controlled using a single object.
Loading

composite-view/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ Wikipedia says
2929

3030
> Composite views that are composed of multiple atomic subviews. Each component of the template may be included dynamically into the whole and the layout of the page may be managed independently of the content. This solution provides for the creation of a composite view based on the inclusion and substitution of modular dynamic and static template fragments. It promotes the reuse of atomic portions of the view by encouraging modular design.
3131
32+
Flowchart
33+
34+
![Composite View flowchart](./etc/composite-view-flowchart.png)
35+
3236
## Programmatic Example of Composite View Pattern in Java
3337

3438
A news site wants to display the current date and news to different users based on that user's preferences. The news site will substitute in different news feed components depending on the user's interest, defaulting to local news.
59.1 KB
Loading

composite/README.md

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

3535
> In software engineering, the composite pattern is a partitioning design pattern. The composite pattern describes that a group of objects is to be treated in the same way as a single instance of an object. The intent of a composite is to "compose" objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly.
3636
37+
Flowchart
38+
39+
![Composite flowchart](./etc/composite-flowchart.png)
40+
3741
## Programmatic Example of Composite Pattern in Java
3842

3943
Every sentence is composed of words which are in turn composed of characters. Each of these objects are printable, and they can have something printed before or after them like sentence always ends with full stop and word always has space before it.

composite/etc/composite-flowchart.png

41.5 KB
Loading

context-object/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ In plain words
3636

3737
> Use a Context Object to encapsulate state in a protocol-independent way to be shared throughout your application.
3838
39+
Sequence diagram
40+
41+
![Context Object sequence diagram](./etc/context-object-sequence-diagram.png)
42+
3943
## Programmatic Example of Context Object in Java
4044

4145
In a multi-layered Java application, different layers such as A, B, and C extract specific information from a shared context. Passing each piece of information individually is inefficient. The Context Object pattern efficiently stores and passes this information, improving the overall performance and maintainability of the Java application.
Loading

converter/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ In plain words
3232

3333
> The Converter Pattern simplifies mapping instances of one class to instances of another class, ensuring consistent and clean data transformation.
3434
35+
Sequence diagram
36+
37+
![Converter sequence diagram](./etc/converter-sequence-diagram.png)
38+
3539
## Programmatic Example of Converter Pattern in Java
3640

3741
In applications, it's common for the database layer to have entities that need mapping to DTOs (Data Transfer Objects) for business logic. This mapping often involves many classes, necessitating a generic solution.
99.4 KB
Loading

curiously-recurring-template-pattern/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ Wikipedia says
4040

4141
> The curiously recurring template pattern (CRTP) is an idiom, originally in C++, in which a class X derives from a class template instantiation using X itself as a template argument.
4242
43+
Flowchart
44+
45+
![Curiously Recurring Template Pattern flowchart](./etc/crtp-flowchart.png)
46+
4347
## Programmatic example of CRTP in Java
4448

4549
For a mixed martial arts promotion that is planning an event, ensuring that the fights are organized between athletes of the same weight class is crucial. This prevents mismatches between fighters of significantly different sizes, such as a heavyweight facing off against a bantamweight.
Loading

currying/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ Wikipedia says
3333

3434
> In mathematics and computer science, currying is the technique of translating a function that takes multiple arguments into a sequence of families of functions, each taking a single argument.
3535
36+
Sequence diagram
37+
38+
![Currying sequence diagram](./etc/currying-sequence-diagram.png)
39+
3640
## Programmatic example of Currying Pattern in Java
3741

3842
Consider a librarian who wants to populate their library with books. The librarian wants functions which can create books corresponding to specific genres and authors. Currying makes this possible by writing a curried book builder function and utilising partial application.
67.6 KB
Loading

0 commit comments

Comments
 (0)