Skip to content
This repository has been archived by the owner on Sep 15, 2019. It is now read-only.

Commit

Permalink
Added umls for prototype and template method patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniloNovakovic committed Aug 21, 2019
1 parent ceab51e commit d3503cb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ This pattern creates a decorator class which wraps the original class and provid

Example of decorator can be found in `AuthLoggerDecorator` class which is used to decorate logging messages with `username` attribute.

![Decorator UML](doc/decorator.png)
![Decorator UML](doc/decorator.PNG)

### Command

Expand All @@ -186,15 +186,15 @@ This project introduces two types of commands:
- `ICommand` - Used by WPF for Binding.
- `IUndoableCommand` - Used by `CommandManager` for *Undo* / *Redo* functionality.

![Command UML](doc/command.png)
![Command UML](doc/command.PNG)

### Factory Method

In class-based programming, the factory method pattern is a creational pattern that uses factory methods to deal with the problem of creating objects without having to specify the exact class of the object that will be created. This is done by creating objects by calling a factory method either specified in an interface and implemented by child classes, or implemented in a base class and optionally overridden by derived classes rather than by calling a constructor.

Example of Factory used in this project can be found in `AuthServiceHostFactory` which is used to make `ServiceHost` with customized headers used for authentification.

![Factory Method UML](doc/factory-method.png)
![Factory Method UML](doc/factory-method.PNG)

### Facade

Expand All @@ -204,16 +204,24 @@ This pattern involves a single class which provides simplified methods required

Example of Facade pattern for this project can be found in `AuthServiceHostFactoryFacade` whose main goal is to simplify usage of `AuthServiceHostFactory`.

![Facade UML](doc/facade.png)
![Facade UML](doc/facade.PNG)

### Template Method

Template method pattern is a behavioral design pattern that defines the program skeleton of an algorithm in an operation, deferring some steps to subclasses. It lets one redefine certain steps of an algorithm without changing the algorithm's structure.

This project uses Template Method pattern for Form ViewModels where base class would implement all of the required logic but `OnSubmit` behavior would be abstracted away for child classes to implement.

![Template Method UML](doc/template-method.PNG)

### Prototype

The prototype pattern is a creational design pattern in software development. It is used when the type of objects to create is determined by a prototypical instance, which is cloned to produce new objects.

This project uses Prototype pattern by implementing provided `ICloneable` interface. Example of class objects that use this are Model classes from `Client.Core`. When they are passed to the `Edit` Form View Model they need to be cloned so that passed class is not accidently modified by reference.

![Prototype UML](doc/prototype.PNG)

---

Copyright 2019 © [DaniloNovakovic](https://github.com/DaniloNovakovic)
Binary file modified doc/DesignPatterns.EAP
Binary file not shown.
Binary file added doc/prototype.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/template-method.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d3503cb

Please sign in to comment.