Skip to content

Resync #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion abstract-document/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ tags:
## Intent
Achieve flexibility of untyped languages and keep the type-safety

## Class diagram
![alt text](./etc/abstract-document.png "Abstract Document Traits and Domain")


Expand All @@ -26,4 +27,4 @@ Use the Abstract Document Pattern when
## Credits

* [Wikipedia: Abstract Document Pattern](https://en.wikipedia.org/wiki/Abstract_Document_Pattern)
* [Martin Fowler: Dealing with properties](http://martinfowler.com/apsupp/properties.pdf)
* [Martin Fowler: Dealing with properties](http://martinfowler.com/apsupp/properties.pdf)
65 changes: 65 additions & 0 deletions abstract-document/etc/abstract-document.urm.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
@startuml
package com.iluwatar.abstractdocument.domain.enums {
enum Property {
+ MODEL {static}
+ PARTS {static}
+ PRICE {static}
+ TYPE {static}
+ valueOf(name : String) : Property {static}
+ values() : Property[] {static}
}
}
package com.iluwatar.abstractdocument.domain {
class Car {
+ Car(properties : Map<String, Object>)
}
interface HasModel {
+ getModel() : Optional<String>
}
interface HasParts {
+ getParts() : Stream<Part>
}
interface HasPrice {
+ getPrice() : Optional<Number>
}
interface HasType {
+ getType() : Optional<String>
}
class Part {
+ Part(properties : Map<String, Object>)
}
}
package com.iluwatar.abstractdocument {
abstract class AbstractDocument {
- properties : Map<String, Object>
# AbstractDocument(properties : Map<String, Object>)
+ children(key : String, constructor : Function<Map<String, Object>, T>) : Stream<T>
+ get(key : String) : Object
+ put(key : String, value : Object)
+ toString() : String
}
class App {
- LOGGER : Logger {static}
+ App()
+ main(args : String[]) {static}
}
interface Document {
+ children(String, Function<Map<String, Object>, T>) : Stream<T> {abstract}
+ get(String) : Object {abstract}
+ put(String, Object) {abstract}
}
}
AbstractDocument ..|> Document
Car ..|> HasModel
Car ..|> HasPrice
Car ..|> HasParts
Car --|> AbstractDocument
HasModel --|> Document
HasParts --|> Document
HasPrice --|> Document
HasType --|> Document
Part ..|> HasType
Part ..|> HasModel
Part ..|> HasPrice
Part --|> AbstractDocument
@enduml
3 changes: 3 additions & 0 deletions abstract-factory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ public static void main(String[] args) {
}
```

## Class diagram
![alt text](./etc/abstract-factory.urm.png "Abstract Factory class diagram")


## Applicability
Use the Abstract Factory pattern when
Expand Down
Binary file added abstract-factory/etc/abstract-factory.urm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
101 changes: 101 additions & 0 deletions abstract-factory/etc/abstract-factory.urm.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
@startuml
package com.iluwatar.abstractfactory {
class App {
- LOGGER : Logger {static}
- army : Army
- castle : Castle
- king : King
+ App()
+ createKingdom(factory : KingdomFactory)
+ getArmy() : Army
~ getArmy(factory : KingdomFactory) : Army
+ getCastle() : Castle
~ getCastle(factory : KingdomFactory) : Castle
+ getKing() : King
~ getKing(factory : KingdomFactory) : King
+ main(args : String[]) {static}
- setArmy(army : Army)
- setCastle(castle : Castle)
- setKing(king : King)
}
class FactoryMaker {
+ FactoryMaker()
+ makeFactory(type : KingdomType) : KingdomFactory {static}
}
enum KingdomType {
+ ELF {static}
+ ORC {static}
+ valueOf(name : String) : KingdomType {static}
+ values() : KingdomType[] {static}
}
interface Army {
+ getDescription() : String {abstract}
}
interface Castle {
+ getDescription() : String {abstract}
}
class ElfArmy {
~ DESCRIPTION : String {static}
+ ElfArmy()
+ getDescription() : String
}
class ElfCastle {
~ DESCRIPTION : String {static}
+ ElfCastle()
+ getDescription() : String
}
class ElfKing {
~ DESCRIPTION : String {static}
+ ElfKing()
+ getDescription() : String
}
class ElfKingdomFactory {
+ ElfKingdomFactory()
+ createArmy() : Army
+ createCastle() : Castle
+ createKing() : King
}
interface King {
+ getDescription() : String {abstract}
}
interface KingdomFactory {
+ createArmy() : Army {abstract}
+ createCastle() : Castle {abstract}
+ createKing() : King {abstract}
}
class OrcArmy {
~ DESCRIPTION : String {static}
+ OrcArmy()
+ getDescription() : String
}
class OrcCastle {
~ DESCRIPTION : String {static}
+ OrcCastle()
+ getDescription() : String
}
class OrcKing {
~ DESCRIPTION : String {static}
+ OrcKing()
+ getDescription() : String
}
class OrcKingdomFactory {
+ OrcKingdomFactory()
+ createArmy() : Army
+ createCastle() : Castle
+ createKing() : King
}
}
KingdomType ..+ FactoryMaker
App --> "-castle" Castle
FactoryMaker ..+ App
App --> "-king" King
App --> "-army" Army
ElfArmy ..|> Army
ElfCastle ..|> Castle
ElfKing ..|> King
ElfKingdomFactory ..|> KingdomFactory
OrcArmy ..|> Army
OrcCastle ..|> Castle
OrcKing ..|> King
OrcKingdomFactory ..|> KingdomFactory
@enduml
5 changes: 3 additions & 2 deletions acyclic-visitor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ tags:
- Difficulty-Intermediate
---

![alt text](./etc/acyclic-visitor.png "Acyclic Visitor")

## Intent
Allow new functions to be added to existing class hierarchies without affecting those hierarchies, and without creating the troublesome dependency cycles that are inherent to the GOF VISITOR Pattern.

## Class diagram
![alt text](./etc/acyclic-visitor.png "Acyclic Visitor")

## Applicability
This pattern can be used:
* When you need to add a new function to an existing hierarchy without the need to alter or affect that hierarchy.
Expand Down
53 changes: 53 additions & 0 deletions acyclic-visitor/etc/acyclic-visitor.urm.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
@startuml
package com.iluwatar.acyclicvisitor {
interface AllModemVisitor {
}
class App {
+ App()
+ main(args : String[]) {static}
}
class ConfigureForDosVisitor {
- LOGGER : Logger {static}
+ ConfigureForDosVisitor()
+ visit(hayes : Hayes)
+ visit(zoom : Zoom)
}
class ConfigureForUnixVisitor {
- LOGGER : Logger {static}
+ ConfigureForUnixVisitor()
+ visit(zoom : Zoom)
}
class Hayes {
- LOGGER : Logger {static}
+ Hayes()
+ accept(modemVisitor : ModemVisitor)
+ toString() : String
}
interface HayesVisitor {
+ visit(Hayes) {abstract}
}
abstract class Modem {
+ Modem()
+ accept(ModemVisitor) {abstract}
}
interface ModemVisitor {
}
class Zoom {
- LOGGER : Logger {static}
+ Zoom()
+ accept(modemVisitor : ModemVisitor)
+ toString() : String
}
interface ZoomVisitor {
+ visit(Zoom) {abstract}
}
}
AllModemVisitor --|> ZoomVisitor
AllModemVisitor --|> HayesVisitor
ConfigureForDosVisitor ..|> AllModemVisitor
ConfigureForUnixVisitor ..|> ZoomVisitor
Hayes --|> Modem
HayesVisitor --|> ModemVisitor
Zoom --|> Modem
ZoomVisitor --|> ModemVisitor
@enduml
3 changes: 3 additions & 0 deletions adapter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ var captain = new Captain(new FishingBoatAdapter());
captain.row();
```

## Class diagram
![alt text](./etc/adapter.urm.png "Adapter class diagram")

## Applicability
Use the Adapter pattern when

Expand Down
Binary file added adapter/etc/adapter.urm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions adapter/etc/adapter.urm.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@startuml
package com.iluwatar.adapter {
class App {
- App()
+ main(args : String[]) {static}
}
class Captain {
- rowingBoat : RowingBoat
+ Captain()
+ Captain(boat : RowingBoat)
~ row()
~ setRowingBoat(boat : RowingBoat)
}
~class FishingBoat {
- LOGGER : Logger {static}
~ FishingBoat()
~ sail()
}
class FishingBoatAdapter {
- boat : FishingBoat
+ FishingBoatAdapter()
+ row()
}
interface RowingBoat {
+ row() {abstract}
}
}
FishingBoatAdapter --> "-boat" FishingBoat
Captain --> "-rowingBoat" RowingBoat
FishingBoatAdapter ..|> RowingBoat
@enduml
2 changes: 2 additions & 0 deletions aggregator-microservices/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ More variations of the aggregator are:
- Chained Microservice Design Pattern: In this case each microservice is dependent/ chained to a series
of other microservices.

## Class diagram

![alt text](./etc/aggregator-microservice.png "Aggregator Microservice")

## Applicability
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@startuml
package com.iluwatar.aggregator.microservices {
class Aggregator {
- informationClient : ProductInformationClient
- inventoryClient : ProductInventoryClient
+ Aggregator()
+ getProduct() : Product
}
class App {
+ App()
+ main(args : String[]) {static}
}
class Product {
- productInventories : int
- title : String
+ Product()
+ getProductInventories() : int
+ getTitle() : String
+ setProductInventories(productInventories : int)
+ setTitle(title : String)
}
interface ProductInformationClient {
+ getProductTitle() : String {abstract}
}
class ProductInformationClientImpl {
- LOGGER : Logger {static}
+ ProductInformationClientImpl()
+ getProductTitle() : String
}
interface ProductInventoryClient {
+ getProductInventories() : Integer {abstract}
}
class ProductInventoryClientImpl {
- LOGGER : Logger {static}
+ ProductInventoryClientImpl()
+ getProductInventories() : Integer
}
}
Aggregator --> "-informationClient" ProductInformationClient
Aggregator --> "-inventoryClient" ProductInventoryClient
ProductInformationClientImpl ..|> ProductInformationClient
ProductInventoryClientImpl ..|> ProductInventoryClient
@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@startuml
@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@startuml
package com.iluwatar.information.microservice {
class InformationApplication {
+ InformationApplication()
+ main(args : String[]) {static}
}
class InformationController {
+ InformationController()
+ getProductTitle() : String
}
}
@enduml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@startuml
package com.iluwatar.inventory.microservice {
class InventoryApplication {
+ InventoryApplication()
+ main(args : String[]) {static}
}
class InventoryController {
+ InventoryController()
+ getProductInventories() : int
}
}
@enduml
Loading