You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: localization/de/abstract-factory/README.md
+49-51Lines changed: 49 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,31 +20,30 @@ Das Abstract-Factory-Pattern stellt ein Interface zum Erzeugen von Instanzen ein
20
20
ähnlicher oder voneinander abhängiger Objekte zur Verfügung, ohne dass dabei deren konkrete Klasse
21
21
festgelegt ist. Damit werden Modularität und Flexibilität im Softwaredesign verbessert.
22
22
23
-
## Detailed Explanation of Abstract Factory Pattern with Real-World Examples
23
+
## Detaillierte Erklärung
24
+
Reales Beispiel
24
25
25
-
Real-world example
26
-
27
-
> Imagine a furniture company that uses the Abstract Factory pattern in Java to produce various styles of furniture: modern, Victorian, and rustic. Each style includes products like chairs, tables, and sofas. To ensure consistency within each style, the company uses an Abstract Factory pattern.
26
+
> Stellen Sie sich einen Möbelhersteller vor, der Möbelstücke in verschiedenen Stilen anbietet, z.B. modern, viktorianisch, rustikal. Zu jedem Stil gibt es Produkte wie Stühle, Tische und Sessel. Um Produkte unabhängig vom Stil einheitlich verwalten zu können, wird das Abstract-Factory-Pattern eingesetzt.
28
27
>
29
-
> In this scenario, the Abstract Factory is an interface for creating families of related furniture objects (chairs, tables, sofas). Each concrete factory (ModernFurnitureFactory, VictorianFurnitureFactory, RusticFurnitureFactory) implements the Abstract Factory interface and creates a set of products that match the specific style. This way, clients can create a whole set of modern or Victorian furniture without worrying about the details of their instantiation. This maintains a consistent style and allows easy swapping of one style of furniture for another.
28
+
> Dabei ist die Abstract Factory ein Interface, mit dem mehrere Familien zusammengehöriger Möbelstücke (Stühle, Tische, Sessel) erzeugt werden. Jede einzelne konkrete Factory (ModernFurnitureFactory, VictorianFurnitureFactory, RusticFurnitureFactory) implementiert dieses Interface und erzeugt Möbelstücke des jeweiligen Stils. Auf diese Weise können ganze Einrichtungen in einem bestimmten Stil produziert werden, ohne dass man sich um die Details der Instantiierung kümmern muss. Das erlaubt eine einheitliche Bearbeitung und einen einfachen Wechsel des Einrichtungsstils.
30
29
31
-
In plain words
30
+
In einfachen Worten
32
31
33
-
> A factory of factories; a factory that groups the individual but related/dependent factories together without specifying their concrete classes.
32
+
> Eine Factory für Factories - eine Factory, die mehrere zusammengehörende Factories vereinigt, ohne die konkrete Klasse der Objekte festzulegen.
34
33
35
-
Wikipedia says
34
+
Wikipedia sagt
36
35
37
-
> The abstract factory pattern provides a way to encapsulate a group of individual factories that have a common theme without specifying their concrete classes
36
+
> Das Abstract-Factory-Pattern dient zur Kapselung einer Gruppe einzelner Factories mit gemeinsamem Thema, wobei deren konkrete Klassse variabel bleibt.
38
37
39
-
Class diagram
38
+
Klassendiagramm
40
39
41
40

42
41
43
-
## Programmatic Example of Abstract Factory in Java
42
+
## Programmbeispiel
44
43
45
-
To create a kingdom using the AbstractFactory pattern in Java, 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.
44
+
Um ein Königreich mit dem Abstract-Factory-Pattern zu erzeugen, brauchen wir ein gemeinsames Thema. Das Elben-Königreich hat einen Elbenkönig, ein Elbenschlos und eine Elbenarmee, das Ork-Königreich dagegen einen Orkkönig, ein Orkschloss und eine Orkarmee. Die Objekte des jeweiligen Königreichs hängen voneinander ab.
46
45
47
-
Translating the kingdom example above. First of all, we have some interfaces and implementation for the objects in the kingdom.
46
+
Zunächst definieren wir die Interfaces und implementieren sie für die einzelnen Königreiche.
48
47
49
48
```java
50
49
publicinterfaceCastle {
@@ -59,7 +58,7 @@ public interface Army {
59
58
StringgetDescription();
60
59
}
61
60
62
-
//Elven implementations ->
61
+
//Elben-Implementationen ->
63
62
publicclassElfCastleimplementsCastle {
64
63
staticfinalStringDESCRIPTION="This is the elven castle!";
65
64
@@ -87,10 +86,10 @@ public class ElfArmy implements Army {
87
86
}
88
87
}
89
88
90
-
//Orcish implementations similarly -> ...
89
+
//Ork-Implementations analog -> ...
91
90
```
92
91
93
-
Then we have the abstraction and implementations for the kingdom factory.
92
+
Nun kommt das Interface für die Königreich-Factory und seine Implementationen.
94
93
95
94
```java
96
95
publicinterfaceKingdomFactory {
@@ -119,10 +118,10 @@ public class ElfKingdomFactory implements KingdomFactory {
119
118
}
120
119
}
121
120
122
-
//Orcish implementations similarly -> ...
121
+
//Ork-Implementationen analog -> ...
123
122
```
124
123
125
-
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`. The client can use `FactoryMaker`to create the desired concrete factory which, in turn, will produce different concrete objects (derived from`Army`, `King`, `Castle`). In this example, we also used an enum to parameterize which type of kingdom factory the client will ask for.
124
+
Jetzt können wir eine Factory bauen, die eine Instanz von entweder `ElfKingdomFactory` oder `OrcKingdomFactory` erstellt. Diese nennen wir `FactoryMaker`. Der Client kann `FactoryMaker`verwenden, um die gewünschte Factory zu erzeugen, mit der dann wiederum konkrete Objekte (abgeleitet von`Army`, `King`, `Castle`) erzeugt werden können. In diesem Beispiel nutzen wir ein Enum als Parameter für die gewünschte Art der Factory.
126
125
127
126
```java
128
127
publicstaticclassFactoryMaker {
@@ -140,7 +139,7 @@ public static class FactoryMaker {
140
139
}
141
140
```
142
141
143
-
Here is the main function of our example application:
*[Factory Method](https://java-design-patterns.com/patterns/factory-method/): Abstract Factory uses Factory Methods to create products.
219
-
*[Singleton](https://java-design-patterns.com/patterns/singleton/): AbstractFactory classes are often implemented as Singletons.
220
-
*[Factory Kit](https://java-design-patterns.com/patterns/factory-kit/): Similar to Abstract Factory but focuses on configuring and managing a set of related objects in a flexible way.
216
+
*[Factory-Methoden](https://java-design-patterns.com/patterns/factory-method/): Abstract Factory verwendet Factory-Methoden zur Erzeugung von Produkten.
217
+
*[Singleton](https://java-design-patterns.com/patterns/singleton/): Abstract-Factory-Klassen sind häufig als Singletons implementiert.
218
+
*[Factory Kit](https://java-design-patterns.com/patterns/factory-kit/): Ähnlich wie Abstract Factory, aber mit Schwerpunkt auf flexibler Konfiguration und Verwaltung verwandter Objekte .
221
219
222
-
## References and Credits
220
+
## Quellen
223
221
224
222
*[Design Patterns: Elements of Reusable Object-Oriented Software](https://amzn.to/3w0pvKI)
225
223
*[Design Patterns in Java](https://amzn.to/3Syw0vC)
0 commit comments