Skip to content

Commit 93c6653

Browse files
authored
Merge branch 'iluwatar:master' into master
2 parents b902012 + 15ee32a commit 93c6653

28 files changed

+51
-13
lines changed

commander/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<plugin>
5555
<groupId>org.apache.maven.plugins</groupId>
5656
<artifactId>maven-compiler-plugin</artifactId>
57-
<version>3.13.0</version>
57+
<version>3.14.0</version>
5858
<executions>
5959
<execution>
6060
<id>allCases</id>

hexagonal-architecture/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<dependency>
5555
<groupId>de.flapdoodle.embed</groupId>
5656
<artifactId>de.flapdoodle.embed.mongo</artifactId>
57-
<version>4.18.1</version>
57+
<version>4.20.0</version>
5858
<scope>test</scope>
5959
</dependency>
6060
<dependency>

marker-interface/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ Wikipedia says
3737
>
3838
> To use this pattern, a class implements a marker interface (also called tagging interface) which is an empty interface, and methods that interact with instances of that class test for the existence of the interface. Whereas a typical interface specifies functionality (in the form of method declarations) that an implementing class must support, a marker interface need not do so. The mere presence of such an interface indicates specific behavior on the part of the implementing class. Hybrid interfaces, which both act as markers and specify required methods, are possible but may prove confusing if improperly used.
3939
40+
Flowchart
41+
42+
![Marker Interface flowchart](./etc/marker-interface-flowchart.png)
43+
4044
## Programmatic Example of Marker Interface Pattern in Java
4145

4246
The Marker Interface design pattern is a design pattern in computer science that is used with languages that provide run-time type information about objects. It provides a means to associate metadata with a class where the language does not have explicit support for such metadata.
Loading

master-worker/README.md

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

3434
> Master–slave is a model of asymmetric communication or control where one device or process (the master) controls one or more other devices or processes (the slaves) and serves as their communication hub. In some systems, a master is selected from a group of eligible devices, with the other devices acting in the role of slaves.
3535
36+
Sequence diagram
37+
38+
![Master-Worker sequence diagram](./etc/master-worker-sequence-diagram.png)
39+
3640
## Programmatic Example of Master-Worker Pattern in Java
3741

3842
In the provided code, the `MasterWorker` class initiates the concurrent computation process. The `Master` class divides the work among `Worker` objects, each performing its task in parallel, thus optimizing task processing and enhancing system efficiency.
Loading

mediator/README.md

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

3434
> In software engineering, the mediator pattern defines an object that encapsulates how a set of objects interact. This pattern is considered to be a behavioral pattern due to the way it can alter the program's running behavior. In object-oriented programming, programs often consist of many classes. Business logic and computation are distributed among these classes. However, as more classes are added to a program, especially during maintenance and/or refactoring, the problem of communication between these classes may become more complex. This makes the program harder to read and maintain. Furthermore, it can become difficult to change the program, since any change may affect code in several other classes. With the mediator pattern, communication between objects is encapsulated within a mediator object. Objects no longer communicate directly with each other, but instead communicate through the mediator. This reduces the dependencies between communicating objects, thereby reducing coupling.
3535
36+
Sequence diagram
37+
38+
![Mediator sequence diagram](./etc/mediator-sequence-diagram.png)
39+
3640
## Programmatic Example of Mediator Pattern in Java
3741

3842
In this example, the mediator encapsulates how a set of objects interact. Instead of referring to each other directly, they use the mediator interface.
@@ -175,10 +179,6 @@ Here's the console output from running the example.
175179
14:05:15.083 [main] INFO com.iluwatar.mediator.PartyMemberBase -- Rogue arrives for dinner
176180
```
177181

178-
## Detailed Explanation of Mediator Pattern with Real-World Examples
179-
180-
![Mediator](./etc/mediator_1.png "Mediator")
181-
182182
## When to Use the Mediator Pattern in Java
183183

184184
Use the Mediator pattern when
34.4 KB
Loading

memento/README.md

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

3737
> The memento pattern is a software design pattern that provides the ability to restore an object to its previous state (undo via rollback).
3838
39+
Sequence diagram
40+
41+
![Memento sequence diagram](./etc/memento-sequence-diagram.png)
42+
3943
## Programmatic Example of Memento Pattern in Java
4044

4145
In our astrology application, we use the Memento pattern to capture and restore the state of star objects. Each state is saved as a memento, allowing us to revert to previous states as needed.
42.1 KB
Loading

metadata-mapping/README.md

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

3030
> Create a "virtual [object database](https://en.wikipedia.org/wiki/Object_database)" that can be used from within the programming language.
3131
32+
Flowchart
33+
34+
![Metadata Mapping flowchart](./etc/metadata-mapping-flowchart.png)
35+
3236
## Programmatic Example of Metadata Mapping Pattern in Java
3337

3438
Hibernate ORM Tool uses Metadata Mapping Pattern to specify the mapping between classes and tables either using XML or annotations in code.
Loading

microservices-api-gateway/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ Wikipedia says
3838

3939
> API Gateway is a server that acts as an API front-end, receives API requests, enforces throttling and security policies, passes requests to the back-end service and then passes the response back to the requester. A gateway often includes a transformation engine to orchestrate and modify the requests and responses on the fly. A gateway can also provide functionality such as collecting analytics data and providing caching. The gateway can provide functionality to support authentication, authorization, security, audit and regulatory compliance.
4040
41+
Sequence diagram
42+
43+
![Microservices API Gateway sequence diagram](./etc/microservices-api-gateway-sequence-diagram.png)
44+
4145
## Programmatic Example of Microservice API Gateway in Java
4246

4347
This implementation shows what the API Gateway pattern could look like for an e-commerce site. The`ApiGateway` makes calls to the Image and Price microservices using the `ImageClientImpl` and `PriceClientImpl` respectively. Customers viewing the site on a desktop device can see both price information and an image of a product, so the `ApiGateway` calls both of the microservices and aggregates the data in the `DesktopProduct` model. However, mobile users only see price information; they do not see a product image. For mobile users, the `ApiGateway` only retrieves price information, which it uses to populate the `MobileProduct`.
Loading

microservices-log-aggregation/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ Wikipedia says
3838

3939
> You have applied the Microservice architecture pattern. The application consists of multiple services and service instances that are running on multiple machines. Requests often span multiple service instances. Each service instance generates writes information about what it is doing to a log file in a standardized format. The log file contains errors, warnings, information and debug messages.
4040
41+
Flowchart
42+
43+
![Microservices Log Aggregration flowchart](./etc/microservices-log-aggregation-flowchart.png)
44+
4145
## Programmatic Example of Microservices Log Aggregation Pattern in Java
4246

4347
Log Aggregation is a pattern that centralizes the collection, storage, and analysis of logs from multiple sources to facilitate monitoring, debugging, and operational intelligence. It is particularly useful in distributed systems where logs from various components need to be centralized for better management and analysis.
Loading

monad/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ Wikipedia says
4343

4444
> 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.
4545
46+
Flowchart
47+
48+
![Monad flowchart](./etc/monad-flowchart.png)
49+
4650
## Programmatic Example of Monad Pattern in Java
4751

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

monad/etc/monad-flowchart.png

62.6 KB
Loading

monitor/README.md

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

3737
> In concurrent programming (also known as parallel programming), a monitor is a synchronization construct that allows threads to have both mutual exclusion and the ability to wait (block) for a certain condition to become false. Monitors also have a mechanism for signaling other threads that their condition has been met.
3838
39+
Sequence diagram
40+
41+
![Monitor sequence diagram](./etc/monitor-sequence-diagram.png)
42+
3943
## Programmatic Example of Monitor Pattern in Java
4044

4145
The Monitor design pattern is a synchronization technique used in concurrent programming to ensure that only one thread can execute a particular section of code at a time. It is a method of wrapping and hiding the synchronization primitives (like semaphores or locks) within the methods of an object. This pattern is useful in situations where race conditions could occur.
75.9 KB
Loading

monostate/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ wiki.c2.com says
3434

3535
> A monostate is a "conceptual singleton" - all data members of a monostate are static, so all instances of the monostate use the same (static) data. Applications using a monostate can create any number of instances that they desire, as each instance uses the same data.
3636
37+
Flowchart
38+
39+
![Monostate flowchart](./etc/monostate-flowchart.png)
40+
3741
## Programmatic Example of Monostate Pattern in Java
3842

3943
The Monostate pattern in Java ensures that all instances of a class share the same state, making it a great Singleton alternative for maintaining consistent data. This is achieved by using static fields in the class. Any changes to these fields will be reflected across all instances of the class. This pattern is useful when you want to avoid global variables but still need a shared state across multiple instances.

monostate/etc/monostate-flowchart.png

54.4 KB
Loading

multiton/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ Wikipedia says
3232

3333
> In software engineering, the multiton pattern is a design pattern which generalizes the singleton pattern. Whereas the singleton allows only one instance of a class to be created, the multiton pattern allows for the controlled creation of multiple instances, which it manages through the use of a map.
3434
35+
Flowchart
36+
37+
![Multiton flowchart](./etc/multiton-flowchart.png)
38+
3539
## Programmatic Example of Multiton Pattern in Java
3640

3741
In this tutorial, we’ll explore how to implement the Multiton pattern in Java, covering its structure, benefits, and providing code examples. By following these implementation tips, you’ll be able to effectively utilize this Java design pattern.

multiton/etc/multiton-flowchart.png

45.3 KB
Loading

mute-idiom/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ In plain words
3434

3535
> The Mute Idiom design pattern suppresses the handling of trivial or non-critical exceptions to simplify code.
3636
37+
Flowchart
38+
39+
![Mute Idiom flowchart](./etc/mute-idiom-flowchart.png)
40+
3741
## Programmatic Example of Mute Idiom Pattern in Java
3842

3943
In the following Java code example, we demonstrate the Mute Idiom by muting non-critical exceptions during the resource management process. This approach ensures error handling does not interrupt the main logic.
50.8 KB
Loading

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
<gson.version>2.11.0</gson.version>
5353
<guice.version>6.0.0</guice.version>
5454
<system-lambda.version>1.1.0</system-lambda.version>
55-
<lombok.version>1.18.36</lombok.version>
55+
<lombok.version>1.18.38</lombok.version>
5656
<mongo.version>5.4.0</mongo.version>
5757
<bson.version>5.4.0</bson.version>
5858
<h2.version>2.3.232</h2.version>

table-inheritance/pom.xml

-6
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,6 @@
4343
<artifactId>junit-jupiter-engine</artifactId>
4444
<scope>test</scope>
4545
</dependency>
46-
<dependency>
47-
<groupId>org.projectlombok</groupId>
48-
<artifactId>lombok</artifactId>
49-
<version>1.18.36</version>
50-
<scope>provided</scope>
51-
</dependency>
5246
</dependencies>
5347

5448

0 commit comments

Comments
 (0)