docs: add diagrams for facade, factory kit, factory method, factory, fan-out/fan-in, feature toggle, filterer, fluent interface, flyweight, front controller, function composition

This commit is contained in:
Ilkka Seppälä
2025-04-06 19:10:43 +03:00
parent aef4b37c9a
commit 9b64cdee98
21 changed files with 40 additions and 5 deletions
+4 -4
View File
@@ -39,6 +39,10 @@ Wikipedia says
> Function composition is an act or mechanism to combine simple functions to build more complicated ones. Like the usual composition of functions in mathematics, the result of each function is passed as the argument of the next, and the result of the last one is the result of the whole.
Sequence diagram
![Function Composition sequence diagram](./etc/function-composition-sequence-diagram.png)
## Programmatic Example of Function Composition Pattern in Java
In the functional programming paradigm, function composition is a powerful technique. For instance, in Java, you can use higher-order functions to compose operations like multiplying and squaring numbers.
@@ -81,10 +85,6 @@ Result of composing 'timesTwo' and 'square' functions applied to 3 is: 36
This example demonstrates how the Function Composition pattern can be used to create complex functions by composing simpler ones, enhancing modularity and reusability of function-based logic.
## Function Composition Pattern Sequence diagram
![Functional Composition Diagram](./etc/function.composition.urm.png "Functional Composition")
## When to Use the Function Composition Pattern in Java
Use the Function Composition pattern when:
Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB