Skip to content

Commit 9b64cde

Browse files
committed
docs: add diagrams for facade, factory kit, factory method, factory, fan-out/fan-in, feature toggle, filterer, fluent interface, flyweight, front controller, function composition
1 parent aef4b37 commit 9b64cde

21 files changed

+40
-5
lines changed

facade/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ Wikipedia says
3333

3434
> A facade is an object that provides a simplified interface to a larger body of code, such as a class library.
3535
36+
Sequence diagram
37+
38+
![Facade sequence diagram](./etc/facade-sequence-diagram.png)
39+
3640
## Programmatic Example of Facade Pattern in Java
3741

3842
Here's an example of the Facade Design Pattern in a goldmine scenario, demonstrating how a Java facade can streamline complex operations.
61.9 KB
Loading

factory-kit/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ In plain words
3232

3333
> Factory kit is a configurable object builder, a factory to create factories.
3434
35+
Sequence diagram
36+
37+
![Factory Kit sequence diagram](./etc/factory-kit-sequence-diagram.png)
38+
3539
## Programmatic Example of Factory Kit Pattern in Java
3640

3741
Imagine a magical weapon factory in Java capable of creating any desired weapon using the Factory Kit Pattern. This pattern allows for configurable object builders, making it ideal for scenarios where the types of objects are not known upfront.
44 KB
Loading

factory-method/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ Wikipedia says
3636

3737
> In class-based programming, the factory method pattern is a creational pattern that uses factory methods to deal with the problem of creating objects without having to specify the exact class of the object that will be created. This is done by creating objects by calling a factory method — either specified in an interface and implemented by child classes, or implemented in a base class and optionally overridden by derived classes—rather than by calling a constructor.
3838
39+
Sequence diagram
40+
41+
![Factory Method sequence diagram](./etc/factory-method-sequence-diagram.png)
42+
3943
## Programmatic Example of Factory Method Pattern in Java
4044

4145
The Factory Method approach is pivotal in Java Design Patterns for achieving flexible and maintainable code as we see in the following example.
59 KB
Loading

factory/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ Wikipedia says
2626

2727
> Factory is an object for creating other objects – formally a factory is a function or method that returns objects of a varying prototype or class.
2828
29+
Sequence diagram
30+
31+
![Factory sequence diagram](./etc/factory-sequence-diagram.png)
32+
2933
## Programmatic Example of Factory Pattern in Java
3034

3135
Imagine an alchemist who is about to manufacture coins. The alchemist must be able to create both gold and copper coins and switching between them must be possible without modifying the existing source code. The factory pattern makes it possible by providing a static construction method which can be called with relevant parameters.
28.8 KB
Loading

fanout-fanin/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ Wikipedia says
3535
>
3636
> The fan-in concept, on the other hand, typically refers to the aggregation of multiple inputs. In digital electronics, it describes the number of inputs a logic gate can handle. Combining these concepts, the Fan-Out/Fan-In pattern in software engineering involves distributing tasks (fan-out) and then aggregating the results (fan-in).
3737
38+
Sequence diagram
39+
40+
![Fan-Out/Fan-In flowchart](./etc/fan-out-fan-in-flowchart.png)
41+
3842
## Programmatic Example of Fan-Out/Fan-In Pattern in Java
3943

4044
The provided implementation involves a list of numbers with the objective to square them and aggregate the results. The `FanOutFanIn` class receives the list of numbers as `SquareNumberRequest` objects and a `Consumer` instance that collects the squared results as the requests complete. Each `SquareNumberRequest` squares its number with a random delay, simulating a long-running process that finishes at unpredictable times. The `Consumer` instance gathers the results from the various `SquareNumberRequest` objects as they become available at different times.
61.2 KB
Loading

0 commit comments

Comments
 (0)