Compare commits

..

3 Commits

Author SHA1 Message Date
Subhrodip Mohanta
c95a2a1413 Removed Conflicts 2021-10-21 23:35:03 +05:30
allcontributors[bot]
657c16720e docs: update .all-contributorsrc [skip ci] 2021-10-21 23:35:03 +05:30
allcontributors[bot]
d77915a3b7 docs: update README.md [skip ci] 2021-10-21 23:34:22 +05:30
173 changed files with 213 additions and 538 deletions

View File

@@ -1676,60 +1676,6 @@
"contributions": [
"translation"
]
},
{
"login": "ManviGoel26",
"name": "Manvi Goel",
"avatar_url": "https://avatars.githubusercontent.com/u/55682355?v=4",
"profile": "https://github.com/ManviGoel26",
"contributions": [
"doc"
]
},
{
"login": "blueberry404",
"name": "Anum Amin",
"avatar_url": "https://avatars.githubusercontent.com/u/39243539?v=4",
"profile": "https://github.com/blueberry404",
"contributions": [
"doc"
]
},
{
"login": "uh-zz",
"name": "Reo Uehara",
"avatar_url": "https://avatars.githubusercontent.com/u/47747828?v=4",
"profile": "https://uh-zz.github.io/blog/",
"contributions": [
"translation"
]
},
{
"login": "Fiordy",
"name": "Fiordy",
"avatar_url": "https://avatars.githubusercontent.com/u/53420573?v=4",
"profile": "https://github.com/Fiordy",
"contributions": [
"doc"
]
},
{
"login": "harshalkh",
"name": "Harshal",
"avatar_url": "https://avatars.githubusercontent.com/u/37841724?v=4",
"profile": "https://github.com/harshalkh",
"contributions": [
"code"
]
},
{
"login": "vashisthabhinav",
"name": "Abhinav Vashisth",
"avatar_url": "https://avatars.githubusercontent.com/u/89785800?v=4",
"profile": "https://www.linkedin.com/in/abhinav-vashisth-06613b208/",
"contributions": [
"doc"
]
}
],
"contributorsPerLine": 7,

View File

@@ -24,9 +24,6 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
# We are using two jobs here for testing our code on the latest JDK 11 build as well as a more satble build version of 11.0.3
# You can see the full discussion here https://github.com/iluwatar/java-design-patterns/pull/1868#issue-1029459688
name: Java CI
on:
@@ -36,11 +33,12 @@ on:
jobs:
# This Workflow Job will build this project and run Sonar analysis using JDK 11.0.3
build-and-analyze:
build:
name: Build and Run Sonar analysis on JDK 11.0.3
runs-on: ubuntu-20.04
strategy:
matrix:
java-version: [ 11.0.3, 11 ]
steps:
- name: Checkout Code
@@ -49,14 +47,12 @@ jobs:
# Disabling shallow clone for improving relevancy of SonarQube reporting
fetch-depth: 0
- name: Set up JDK 11.0.3
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v2
with:
java-version: 11.0.3
java-version: ${{ matrix.java-version }}
distribution: 'zulu'
cache: 'maven'
# Cache Sonar packages which as used to run anaylysis and collect metrics
- name: Cache SonarCloud packages
uses: actions/cache@v2
with:
@@ -64,6 +60,14 @@ jobs:
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven dependencies
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
# Some tests need screen access
- name: Install xvfb
run: sudo apt-get install -y xvfb
@@ -74,28 +78,3 @@ jobs:
# These two env variables are needed for sonar analysis
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# This Workflow Job is going to build the project on the latest stable JDK 11
build:
name: Build and Test on JDK 11
runs-on: ubuntu-20.04
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Set up JDK 11 (Latest)
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'zulu'
cache: 'maven'
# Some tests need screen access
- name: Install xvfb
run: sudo apt-get install -y xvfb
- name: Build with Maven
run: xvfb-run ./mvnw clean verify

View File

@@ -34,13 +34,11 @@ on:
jobs:
build:
name: Build JDP
runs-on: ubuntu-20.04
strategy:
matrix:
java-version: [ 11.0.3, 11 ]
steps:
- name: Checkout Code
uses: actions/checkout@v2
@@ -49,7 +47,14 @@ jobs:
with:
java-version: ${{ matrix.java-version }}
distribution: 'zulu'
cache: 'maven'
- name: Cache Maven Dependecies
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
# Some tests need screen access
- name: Install xvfb

View File

@@ -10,18 +10,18 @@
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=iluwatar_java-design-patterns&metric=coverage)](https://sonarcloud.io/dashboard?id=iluwatar_java-design-patterns)
[![Join the chat at https://gitter.im/iluwatar/java-design-patterns](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/iluwatar/java-design-patterns?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-190-orange.svg?style=flat-square)](#contributors-)
[![All Contributors](https://img.shields.io/badge/all_contributors-183-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
<br/>
Read in different language : [**zh**](localization/zh/README.md), [**ko**](localization/ko/README.md), [**fr**](localization/fr/README.md), [**tr**](localization/tr/README.md), [**ar**](localization/ar/README.md), [**es**](localization/es/README.md), [**pt**](localization/pt/README.md), [**id**](localization/id/README.md), [**ru**](localization/ru/README.md), [**de**](localization/de/README.md), [**ja**](localization/ja/README.md)
Read in different language : [**zh**](localization/zh/README.md), [**ko**](localization/ko/README.md), [**fr**](localization/fr/README.md), [**tr**](localization/tr/README.md), [**ar**](localization/ar/README.md), [**es**](localization/es/README.md), [**pt**](localization/pt/README.md), [**id**](localization/id/README.md), [**ru**](localization/ru/README.md), [**de**](localization/de/README.md)
<br/>
# Introduction
Design patterns are the best, formalized practices a programmer can use to
Design patterns are the best formalized practices a programmer can use to
solve common problems when designing an application or system.
Design patterns can speed up the development process by providing tested, proven
@@ -34,11 +34,11 @@ are familiar with the patterns.
# Getting started
This site showcases Java Design Patterns. The solutions have been developed by
experienced programmers and architects from the open-source community. The
patterns can be browsed by their high-level descriptions or by looking at their
source code. The source code examples are well commented and can be thought of as
experienced programmers and architects from the open source community. The
patterns can be browsed by their high level descriptions or by looking at their
source code. The source code examples are well commented and can be thought as
programming tutorials on how to implement a specific pattern. We use the most
popular battle-proven open-source Java technologies.
popular battle-proven open source Java technologies.
Before you dive into the material, you should be familiar with various
[Software Design Principles](https://java-design-patterns.com/principles/).
@@ -56,8 +56,8 @@ of the following approaches
- Using tags such as `Performance`, `Gang of Four` or `Data access`.
- Using pattern categories, `Creational`, `Behavioral`, and others.
Hopefully, you find the object-oriented solutions presented on this site useful
in your architectures and have as much fun learning them as we had while developing them.
Hopefully you find the object oriented solutions presented on this site useful
in your architectures and have as much fun learning them as we had developing them.
# How to contribute
@@ -312,14 +312,6 @@ This project is licensed under the terms of the MIT license.
<tr>
<td align="center"><a href="http://carlfx.wordpress.com"><img src="https://avatars.githubusercontent.com/u/1594624?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Carl Dea</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=carldea" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/Mozartuss"><img src="https://avatars.githubusercontent.com/u/32893711?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Mozartus</b></sub></a><br /><a href="#translation-Mozartuss" title="Translation">🌍</a></td>
<td align="center"><a href="https://github.com/ManviGoel26"><img src="https://avatars.githubusercontent.com/u/55682355?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Manvi Goel</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=ManviGoel26" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/blueberry404"><img src="https://avatars.githubusercontent.com/u/39243539?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Anum Amin</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=blueberry404" title="Documentation">📖</a></td>
<td align="center"><a href="https://uh-zz.github.io/blog/"><img src="https://avatars.githubusercontent.com/u/47747828?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Reo Uehara</b></sub></a><br /><a href="#translation-uh-zz" title="Translation">🌍</a></td>
<td align="center"><a href="https://github.com/Fiordy"><img src="https://avatars.githubusercontent.com/u/53420573?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Fiordy</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=Fiordy" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/harshalkh"><img src="https://avatars.githubusercontent.com/u/37841724?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Harshal</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=harshalkh" title="Code">💻</a></td>
</tr>
<tr>
<td align="center"><a href="https://www.linkedin.com/in/abhinav-vashisth-06613b208/"><img src="https://avatars.githubusercontent.com/u/89785800?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Abhinav Vashisth</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=vashisthabhinav" title="Documentation">📖</a></td>
</tr>
</table>

View File

@@ -28,7 +28,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>abstract-document</artifactId>
<dependencies>

View File

@@ -87,36 +87,24 @@ public interface KingdomFactory {
}
public class ElfKingdomFactory implements KingdomFactory {
@Override
public Castle createCastle() {
return new ElfCastle();
}
@Override
public King createKing() {
return new ElfKing();
}
@Override
public Army createArmy() {
return new ElfArmy();
}
}
public class OrcKingdomFactory implements KingdomFactory {
@Override
public Castle createCastle() {
return new OrcCastle();
}
@Override
public King createKing() {
return new OrcKing();
}
@Override
public Army createArmy() {
return new OrcArmy();
}

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>abstract-factory</artifactId>
<dependencies>

View File

@@ -124,7 +124,3 @@ Now, we can create multiple creatures such as Orcs, tell them to eat and roam, a
## Class diagram
![alt text](./etc/active-object.urm.png "Active Object class diagram")
## Tutorials
* [Android and Java Concurrency: The Active Object Pattern](https://www.youtube.com/watch?v=Cd8t2u5Qmvc)

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>active-object</artifactId>
<dependencies>

View File

@@ -138,10 +138,6 @@ This pattern can be used:
* When the visited class hierarchy will be frequently extended with new derivatives of the Element class.
* When the recompilation, relinking, retesting or redistribution of the derivatives of Element is very expensive.
## Tutorial
* [Acyclic Visitor Pattern Example](https://codecrafter.blogspot.com/2012/12/the-acyclic-visitor-pattern.html)
## Consequences
The good:

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>acyclic-visitor</artifactId>
<properties>

View File

@@ -105,12 +105,6 @@ Use the Adapter pattern when
* you need to use several existing subclasses, but it's impractical to adapt their interface by subclassing every one. An object adapter can adapt the interface of its parent class.
* most of the applications using third party libraries use adapters as a middle layer between the application and the 3rd party library to decouple the application from the library. If another library has to be used only an adapter for the new library is required without having to change the application code.
## Tutorials
* [Dzone](https://dzone.com/articles/adapter-design-pattern-in-java)
* [Refactoring Guru](https://refactoring.guru/design-patterns/adapter/java/example)
* [Baeldung](https://www.baeldung.com/java-adapter-pattern)
## Consequences
Class and object adapters have different trade-offs. A class adapter

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>adapter</artifactId>
<dependencies>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>aggregator-microservices</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>aggregator-service</artifactId>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>aggregator-microservices</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>information-microservice</artifactId>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>aggregator-microservices</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>inventory-microservice</artifactId>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>aggregator-microservices</artifactId>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ambassador</artifactId>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>api-gateway</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>api-gateway-service</artifactId>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>api-gateway</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>image-microservice</artifactId>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>api-gateway</artifactId>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>api-gateway</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>price-microservice</artifactId>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>arrange-act-assert</artifactId>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>async-method-invocation</artifactId>
<dependencies>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>balking</artifactId>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>bridge</artifactId>
<dependencies>

View File

@@ -134,12 +134,6 @@ Use the Builder pattern when
* The algorithm for creating a complex object should be independent of the parts that make up the object and how they're assembled
* The construction process must allow different representations for the object that's constructed
## Tutorials
* [Refactoring Guru](https://refactoring.guru/design-patterns/builder)
* [Oracle Blog](https://blogs.oracle.com/javamagazine/post/exploring-joshua-blochs-builder-design-pattern-in-java)
* [Journal Dev](https://www.journaldev.com/1425/builder-design-pattern-in-java)
## Known uses
* [java.lang.StringBuilder](http://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html)

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>builder</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>business-delegate</artifactId>
<dependencies>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>bytecode</artifactId>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>caching</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>callback</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>chain-of-responsibility</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>circuit-breaker</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>collection-pipeline</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>combinator</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>command</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>commander</artifactId>
<dependencies>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>composite-entity</artifactId>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>composite</artifactId>
<dependencies>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>converter</artifactId>
<modelVersion>4.0.0</modelVersion>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>cqrs</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>dao</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>data-bus</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>data-locality</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>data-mapper</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>data-transfer-object</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>decorator</artifactId>
<dependencies>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>delegation</artifactId>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>dependency-injection</artifactId>
<dependencies>

View File

@@ -28,10 +28,10 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>dirty-flag</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
<name>dirty-flag</name>
<url>http://maven.apache.org</url>
<properties>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>domain-model</artifactId>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>double-buffer</artifactId>

View File

@@ -27,7 +27,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>double-checked-locking</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>double-dispatch</artifactId>
<dependencies>

View File

@@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>eip-message-channel</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>eip-publish-subscribe</artifactId>
<dependencies>

View File

@@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>

View File

@@ -29,7 +29,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>event-aggregator</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>event-asynchronous</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>event-driven-architecture</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>event-queue</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>event-sourcing</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>execute-around</artifactId>
<dependencies>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>extension-objects</artifactId>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>facade</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>factory-kit</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>factory-method</artifactId>
<dependencies>

View File

@@ -41,8 +41,6 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j
public class App {
private static final String MANUFACTURED = "{} manufactured {}";
/**
* Program entry point.
* @param args command line args
@@ -51,14 +49,14 @@ public class App {
Blacksmith blacksmith = new OrcBlacksmith();
Weapon weapon = blacksmith.manufactureWeapon(WeaponType.SPEAR);
LOGGER.info(MANUFACTURED, blacksmith, weapon);
LOGGER.info("{} manufactured {}", blacksmith, weapon);
weapon = blacksmith.manufactureWeapon(WeaponType.AXE);
LOGGER.info(MANUFACTURED, blacksmith, weapon);
LOGGER.info("{} manufactured {}", blacksmith, weapon);
blacksmith = new ElfBlacksmith();
weapon = blacksmith.manufactureWeapon(WeaponType.SPEAR);
LOGGER.info(MANUFACTURED, blacksmith, weapon);
LOGGER.info("{} manufactured {}", blacksmith, weapon);
weapon = blacksmith.manufactureWeapon(WeaponType.AXE);
LOGGER.info(MANUFACTURED, blacksmith, weapon);
LOGGER.info("{} manufactured {}", blacksmith, weapon);
}
}

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>factory</artifactId>
<dependencies>

View File

@@ -31,7 +31,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>fanout-fanin</artifactId>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>feature-toggle</artifactId>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>filterer</artifactId>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>fluentinterface</artifactId>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>flux</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>flyweight</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>front-controller</artifactId>
<dependencies>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>game-loop</artifactId>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<packaging>jar</packaging>
<artifactId>guarded-suspension</artifactId>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>half-sync-half-async</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>hexagonal</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>intercepting-filter</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>interpreter</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>iterator</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<groupId>com.iluwatar.layers</groupId>
<artifactId>layers</artifactId>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>lazy-loading</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>leader-election</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>leader-followers</artifactId>
<dependencies>

View File

@@ -57,11 +57,9 @@ public class Worker implements Runnable {
try {
if (workCenter.getLeader() != null && !workCenter.getLeader().equals(this)) {
synchronized (workCenter) {
if (workCenter.getLeader() != null && !workCenter.getLeader().equals(this)) {
workCenter.wait();
continue;
}
workCenter.wait();
}
continue;
}
final Task task = taskSet.getTask();
synchronized (workCenter) {

View File

@@ -1,59 +0,0 @@
# Java で実装されたデザインパターン
![Java CI](https://github.com/iluwatar/java-design-patterns/workflows/Java%20CI/badge.svg)
[![License MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/iluwatar/java-design-patterns/master/LICENSE.md)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=iluwatar_java-design-patterns&metric=ncloc)](https://sonarcloud.io/dashboard?id=iluwatar_java-design-patterns)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=iluwatar_java-design-patterns&metric=coverage)](https://sonarcloud.io/dashboard?id=iluwatar_java-design-patterns)
[![Join the chat at https://gitter.im/iluwatar/java-design-patterns](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/iluwatar/java-design-patterns?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-185-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
# はじめに
デザインパターンとは、アプリケーションやシステムを設計する際によくある問題を解決するために、プログラマーが使用できる形式化された最良の手法です。
デザインパターンは、テストされ、証明された開発パラダイムを提供することで、開発プロセスを高速化することができます。
デザインパターンを再利用することで、大きな問題を引き起こす微妙な問題を防ぐことができます。
また、デザインパターンを熟知したコーダーやアーキテクトにとっても、コードの読みやすさが向上します。
# はじめる
このサイトでは、Java のデザインパターンを紹介しています。
これらのソリューションは、オープンソースコミュニティの経験豊富なプログラマーやアーキテクトによって開発されています。
パターンは、ハイレベルの説明またはソースコードを確認することで参照できます。
ソースコードの例はよくコメントされていて、特定のパターンをどのように実装するかを説明するプログラミングチュートリアルのようなものです。
私たちは、最も一般的で実績のあるオープンソースの Java 技術を使用しています。
資料に飛び込む前に、さまざまな[ソフトウェア設計の原則](https://java-design-patterns.com/principles/)に精通している必要があります。
すべてのデザインは、可能な限りシンプルであるべきです。
KISS(シンプルにしておけ!この間抜け)、YAGNI(機能は実際に必要となるまでは追加しないのがよい)、そして Do The Simplest Thing That Could Possibly Work(機能する可能性のある中で最もシンプルなことをする)の原則に基づいて設計を始めるべきです。
複雑さやパターンは、実用的な拡張性が必要な場合にのみ導入すべきです。
これらの概念を理解した上で、以下のような方法で[デザインパターン](https://java-design-patterns.com/patterns/) を掘り下げていくことができます。
- 特定のパターンを、パターン名で検索することができます。見つかない場合は、新しいパターンを[ここ](https://github.com/iluwatar/java-design-patterns/issues)で報告してください
- `Performance`, `Gang of Four` もしくは`Data access`などのタグを使用。
- `Creational`, `Behavioral`などのパターンカテゴリーを使用。
このサイトで紹介されているオブジェクト指向のソリューションが、あなたのアーキテクチャに役立ち、私たちが開発したように楽しく学ぶことができますように。
# コントリビュート方法
プロジェクトに貢献したいとお考えの方は、[開発者 wiki](https://github.com/iluwatar/java-design-patterns/wiki)に関連情報が掲載されています。
私たちは、[Gitter チャットルーム](https://gitter.im/iluwatar/java-design-patterns)であなたの質問にお答えします。
# ライセンス
このプロジェクトは、MIT ライセンスの条件の下でライセンスされています。

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>lockable-object</artifactId>
<dependencies>

View File

@@ -27,7 +27,7 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>marker</artifactId>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>master-worker-pattern</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>mediator</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>memento</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>model-view-controller</artifactId>
<dependencies>

View File

@@ -28,7 +28,7 @@
<parent>
<groupId>com.iluwatar</groupId>
<artifactId>java-design-patterns</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<artifactId>model-view-presenter</artifactId>
<name>model-view-presenter</name>

View File

@@ -32,11 +32,11 @@
<parent>
<artifactId>java-design-patterns</artifactId>
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
</parent>
<groupId>com.iluwatar</groupId>
<artifactId>model-view-viewmodel</artifactId>
<version>1.26.0-SNAPSHOT</version>
<version>1.25.0-SNAPSHOT</version>
<properties>
<zk.version>9.0.0</zk.version>
<guava.version>19.0</guava.version>

Some files were not shown because too many files have changed in this diff Show More