Skip to content

Commit d76715b

Browse files
authored
Merge branch 'master' into adapter-grammatical-fixes
2 parents 647afad + c5a4068 commit d76715b

File tree

165 files changed

+4591
-688
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+4591
-688
lines changed

.all-contributorsrc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,6 +1541,33 @@
15411541
"contributions": [
15421542
"code"
15431543
]
1544+
},
1545+
{
1546+
"login": "samuelpsouza",
1547+
"name": "Samuel Souza",
1548+
"avatar_url": "https://avatars.githubusercontent.com/u/17254162?v=4",
1549+
"profile": "https://www.linkedin.com/in/souzasamuel/",
1550+
"contributions": [
1551+
"code"
1552+
]
1553+
},
1554+
{
1555+
"login": "marlo2222",
1556+
"name": "Marlo Henrique",
1557+
"avatar_url": "https://avatars.githubusercontent.com/u/40809563?v=4",
1558+
"profile": "https://github.com/marlo2222",
1559+
"contributions": [
1560+
"translation"
1561+
]
1562+
},
1563+
{
1564+
"login": "AndriyPyzh",
1565+
"name": "AndriyPyzh",
1566+
"avatar_url": "https://avatars.githubusercontent.com/u/57706635?v=4",
1567+
"profile": "https://github.com/AndriyPyzh",
1568+
"contributions": [
1569+
"code"
1570+
]
15441571
}
15451572
],
15461573
"contributorsPerLine": 4,

LICENSE.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2014-2021 Ilkka Seppälä
3+
Copyright © 2014-2021 Ilkka Seppälä
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -19,3 +19,6 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
22+
23+
Module Model-view-viewmodel is using ZK framework
24+
ZK framework is licensed under LGPL and the license can be found at lgpl-3.0.txt

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=iluwatar_java-design-patterns&metric=coverage)](https://sonarcloud.io/dashboard?id=iluwatar_java-design-patterns)
1111
[![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)
1212
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
13-
[![All Contributors](https://img.shields.io/badge/all_contributors-169-orange.svg?style=flat-square)](#contributors-)
13+
[![All Contributors](https://img.shields.io/badge/all_contributors-172-orange.svg?style=flat-square)](#contributors-)
1414
<!-- ALL-CONTRIBUTORS-BADGE:END -->
1515

1616
<br/>
1717

18-
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)
18+
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)
1919

2020
<br/>
2121

@@ -329,6 +329,9 @@ This project is licensed under the terms of the MIT license.
329329
</tr>
330330
<tr>
331331
<td align="center"><a href="https://github.com/Xenilo137"><img src="https://avatars.githubusercontent.com/u/24865069?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Xenilo137</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=Xenilo137" title="Code">💻</a></td>
332+
<td align="center"><a href="https://www.linkedin.com/in/souzasamuel/"><img src="https://avatars.githubusercontent.com/u/17254162?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Samuel Souza</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=samuelpsouza" title="Code">💻</a></td>
333+
<td align="center"><a href="https://github.com/marlo2222"><img src="https://avatars.githubusercontent.com/u/40809563?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Marlo Henrique</b></sub></a><br /><a href="#translation-marlo2222" title="Translation">🌍</a></td>
334+
<td align="center"><a href="https://github.com/AndriyPyzh"><img src="https://avatars.githubusercontent.com/u/57706635?v=4?s=100" width="100px;" alt=""/><br /><sub><b>AndriyPyzh</b></sub></a><br /><a href="https://github.com/iluwatar/java-design-patterns/commits?author=AndriyPyzh" title="Code">💻</a></td>
332335
</tr>
333336
</table>
334337

abstract-factory/README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ objects without specifying their concrete classes.
2020

2121
## Explanation
2222

23-
Real world example
23+
Real-world example
2424

25-
> To create a kingdom we need objects with a common theme. Elven kingdom needs an Elven king, Elven castle and Elven army whereas Orcish kingdom needs an Orcish king, Orcish castle and Orcish army. There is a dependency between the objects in the kingdom.
25+
> To create a kingdom we need objects with a common theme. The elven kingdom needs an elven king, elven castle, and elven army whereas the orcish kingdom needs an orcish king, orcish castle, and orcish army. There is a dependency between the objects in the kingdom.
2626
2727
In plain words
2828

@@ -34,7 +34,7 @@ Wikipedia says
3434
3535
**Programmatic Example**
3636

37-
Translating the kingdom example above. First of all we have some interfaces and implementation for the objects in the
37+
Translating the kingdom example above. First of all, we have some interfaces and implementation for the objects in the
3838
kingdom.
3939

4040
```java
@@ -52,21 +52,21 @@ public interface Army {
5252

5353
// Elven implementations ->
5454
public class ElfCastle implements Castle {
55-
static final String DESCRIPTION = "This is the Elven castle!";
55+
static final String DESCRIPTION = "This is the elven castle!";
5656
@Override
5757
public String getDescription() {
5858
return DESCRIPTION;
5959
}
6060
}
6161
public class ElfKing implements King {
62-
static final String DESCRIPTION = "This is the Elven king!";
62+
static final String DESCRIPTION = "This is the elven king!";
6363
@Override
6464
public String getDescription() {
6565
return DESCRIPTION;
6666
}
6767
}
6868
public class ElfArmy implements Army {
69-
static final String DESCRIPTION = "This is the Elven Army!";
69+
static final String DESCRIPTION = "This is the elven Army!";
7070
@Override
7171
public String getDescription() {
7272
return DESCRIPTION;
@@ -77,7 +77,7 @@ public class ElfArmy implements Army {
7777

7878
```
7979

80-
Then we have the abstraction and implementations for the kingdom factory
80+
Then we have the abstraction and implementations for the kingdom factory.
8181

8282
```java
8383
public interface KingdomFactory {
@@ -111,7 +111,7 @@ public class OrcKingdomFactory implements KingdomFactory {
111111
}
112112
```
113113

114-
Now we have our abstract factory that lets us make family of related objects i.e. Elven kingdom factory creates Elven castle, king and army etc.
114+
Now we have the abstract factory that lets us make a family of related objects i.e. elven kingdom factory creates elven castle, king and army, etc.
115115

116116
```java
117117
var factory = new ElfKingdomFactory();
@@ -127,13 +127,13 @@ army.getDescription();
127127
Program output:
128128

129129
```java
130-
This is the Elven castle!
131-
This is the Elven king!
132-
This is the Elven Army!
130+
This is the elven castle!
131+
This is the elven king!
132+
This is the elven Army!
133133
```
134134

135-
Now, we can design a factory for our different kingdom factories. In this example, we created FactoryMaker, responsible for returning an instance of either ElfKingdomFactory or OrcKingdomFactory.
136-
The client can use FactoryMaker to create the desired concrete factory which, in turn, will produce different concrete objects (Army, King, Castle).
135+
Now, we can design a factory for our different kingdom factories. In this example, we created `FactoryMaker`, responsible for returning an instance of either `ElfKingdomFactory` or `OrcKingdomFactory`.
136+
The client can use `FactoryMaker` to create the desired concrete factory which, in turn, will produce different concrete objects (derived from `Army`, `King`, `Castle`).
137137
In this example, we also used an enum to parameterize which type of kingdom factory the client will ask for.
138138

139139
```java
@@ -179,8 +179,8 @@ public static void main(String[] args) {
179179

180180
Use the Abstract Factory pattern when
181181

182-
* The system should be independent of how its products are created, composed and represented
183-
* The system should be configured with one of multiple families of products
182+
* The system should be independent of how its products are created, composed, and represented
183+
* The system should be configured with one of the multiple families of products
184184
* The family of related product objects is designed to be used together, and you need to enforce this constraint
185185
* You want to provide a class library of products, and you want to reveal just their interfaces, not their implementations
186186
* The lifetime of the dependency is conceptually shorter than the lifetime of the consumer.
@@ -196,13 +196,13 @@ Example use cases
196196
* Unit test case writing becomes much easier
197197
* UI tools for different OS
198198

199-
## Consequences:
199+
## Consequences
200200

201201
* Dependency injection in java hides the service class dependencies that can lead to runtime errors that would have been caught at compile time.
202202
* While the pattern is great when creating predefined objects, adding the new ones might be challenging.
203-
* The code becomes more complicated than it should be, since a lot of new interfaces and classes are introduced along with the pattern.
203+
* The code becomes more complicated than it should be since a lot of new interfaces and classes are introduced along with the pattern.
204204

205-
## Tutorial
205+
## Tutorials
206206

207207
* [Abstract Factory Pattern Tutorial](https://www.journaldev.com/1418/abstract-factory-design-pattern-in-java)
208208

abstract-factory/src/main/java/com/iluwatar/abstractfactory/App.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
* <p>The essence of the Abstract Factory pattern is a factory interface ({@link KingdomFactory})
3939
* and its implementations ( {@link ElfKingdomFactory}, {@link OrcKingdomFactory}). The example uses
40-
* both concrete implementations to create a king, a castle and an army.
40+
* both concrete implementations to create a king, a castle, and an army.
4141
*/
4242
@Slf4j
4343
public class App implements Runnable {
@@ -60,13 +60,13 @@ public static void main(String[] args) {
6060

6161
@Override
6262
public void run() {
63-
LOGGER.info("Elf Kingdom");
63+
LOGGER.info("elf kingdom");
6464
createKingdom(Kingdom.FactoryMaker.KingdomType.ELF);
6565
LOGGER.info(kingdom.getArmy().getDescription());
6666
LOGGER.info(kingdom.getCastle().getDescription());
6767
LOGGER.info(kingdom.getKing().getDescription());
6868

69-
LOGGER.info("Orc Kingdom");
69+
LOGGER.info("orc kingdom");
7070
createKingdom(Kingdom.FactoryMaker.KingdomType.ORC);
7171
LOGGER.info(kingdom.getArmy().getDescription());
7272
LOGGER.info(kingdom.getCastle().getDescription());

abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfArmy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*/
2929
public class ElfArmy implements Army {
3030

31-
static final String DESCRIPTION = "This is the Elven Army!";
31+
static final String DESCRIPTION = "This is the elven army!";
3232

3333
@Override
3434
public String getDescription() {

abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfCastle.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*/
2929
public class ElfCastle implements Castle {
3030

31-
static final String DESCRIPTION = "This is the Elven castle!";
31+
static final String DESCRIPTION = "This is the elven castle!";
3232

3333
@Override
3434
public String getDescription() {

abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfKing.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*/
2929
public class ElfKing implements King {
3030

31-
static final String DESCRIPTION = "This is the Elven king!";
31+
static final String DESCRIPTION = "This is the elven king!";
3232

3333
@Override
3434
public String getDescription() {

abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcArmy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*/
2929
public class OrcArmy implements Army {
3030

31-
static final String DESCRIPTION = "This is the Orc Army!";
31+
static final String DESCRIPTION = "This is the orc army!";
3232

3333
@Override
3434
public String getDescription() {

abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcCastle.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*/
2929
public class OrcCastle implements Castle {
3030

31-
static final String DESCRIPTION = "This is the Orc castle!";
31+
static final String DESCRIPTION = "This is the orc castle!";
3232

3333
@Override
3434
public String getDescription() {

0 commit comments

Comments
 (0)