mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-14 10:58:42 +00:00
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:
@@ -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
|
||||
|
||||

|
||||
|
||||
## 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
|
||||
|
||||

|
||||
|
||||
## 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 |
Reference in New Issue
Block a user