docs: add diagrams for marker interface, master-worker, mediator, memento, metadata mapping, microservices api gateway, microservices log aggregation, monad, monitor, monostate, multiton, mute idiom

This commit is contained in:
Ilkka Seppälä committed 2025-04-07 22:14:20 +03:00
1 parent 72eeb167c5
commit 8d5cb59388
24 files changed
+48 -4

No files matched your search

+4
View File
@@ -43,6 +43,10 @@ Wikipedia says
> In functional programming, a monad is a structure that combines program fragments (functions) and wraps their return values in a type with additional computation. In addition to defining a wrapping monadic type, monads define two operators: one to wrap a value in the monad type, and another to compose together functions that output values of the monad type (these are known as monadic functions). General-purpose languages use monads to reduce boilerplate code needed for common operations (such as dealing with undefined values or fallible functions, or encapsulating bookkeeping code). Functional languages use monads to turn complicated sequences of functions into succinct pipelines that abstract away control flow, and side effects.
Flowchart
![Monad flowchart](./etc/monad-flowchart.png)
## Programmatic Example of Monad Pattern in Java
Here’s the Monad implementation in Java. The `Validator` class encapsulates an object and performs validation steps in a monadic fashion, showcasing the benefits of using the Monad pattern for error handling and state management.
Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB