From 23c932e8d2a328f9fb2f1cce0458cc3fce4fe0c4 Mon Sep 17 00:00:00 2001 From: Petrutiu Mihai Date: Thu, 14 Jul 2016 15:09:05 +0300 Subject: [PATCH 1/3] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9617c46..1aea2a5 100644 --- a/README.md +++ b/README.md @@ -235,16 +235,16 @@ Mediator class diagram, while it is hard to make a generic one, as it can vary, * Don't know ### f. Examples -[StockExchangeMediator]: https://github.com/MihaiTheCoder/BehavioralPatterns/blob/master/BehavioralPatternsDiagrams/Mediator/AirTraficControllerClassDiagram.PNG "stock exchange mediator class diagram" +[AirTraficMediator]: https://github.com/MihaiTheCoder/BehavioralPatterns/blob/master/BehavioralPatternsDiagrams/Mediator/AirTraficControllerClassDiagram.PNG "stock exchange mediator class diagram" * StockExchange example: Starting class: StockExchange.StockExchangeExample * Have multiple traders Buy/Sell actions from stock exchange (simplified) - * Classs diagram: ![alt text][StockExchangeMediator] * Ground-Air traffic control example: Starting class: GroupAirTrafficControl.GroundAirTrafficControlExample * Have 4 planes that want to land on an airport, the airport has 4 lines (one not working). They all talk to air traffic control(mediator) to ask permission to land, instead of talking to each other * Air traffic control example: Starting class: FlightAirTrafficControl.FlightAirTrafficControlExample * Have multiple planes flying in the same zone, at different attitudes, instead of having them communicating to each other, they all comunicate to the tower, and the tower tells them if they need to change the altitude + * Classs diagram: ![alt text][AirTraficMediator] * Many to many relationship in code: No running class, only the models: User-UserToGroup-Group * Other possible examples that are not yet implemented -> Chat application, GUI Library, Taxi/Taxi Center From ba5bfb7f6a35ad198dc906c0d282a7fca813148a Mon Sep 17 00:00:00 2001 From: Petrutiu Mihai Date: Thu, 14 Jul 2016 16:42:01 +0300 Subject: [PATCH 2/3] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1aea2a5..51acf7c 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Patterns described: [8. Strategy pattern](https://github.com/MihaiTheCoder/BehavioralPatterns/blob/master/README.md#8-strategy-pattern) -[9. Template pattern](https://github.com/MihaiTheCoder/BehavioralPatterns/blob/master/README.md#9-template-pattern) +[9. Template method pattern](https://github.com/MihaiTheCoder/BehavioralPatterns/blob/master/README.md#9-template-pattern) [10 Visitor pattern](https://github.com/MihaiTheCoder/BehavioralPatterns/blob/master/README.md#10-visitor-pattern) @@ -408,14 +408,14 @@ The strategy pattern defines a family of algorithms, encapsulates each algorithm * Motivational example: ArrangeInterview.ArrangeInterviewMotivationalExample -9. Template pattern +9. Template method pattern ------------------ ### a. Pattern description In software engineering, the template method pattern is a behavioral design pattern that defines the program skeleton of an algorithm in an operation, defering some steps to subclasses. It lets one redefine certain steps of an algorithm without changing the algorithm's structure. Template pattern works using 'the Hollywood principle' from the base class point of view: 'Don't call us, we'll call you' -### b. When to use Template pattern +### b. When to use Template method pattern * Let subclasses implement (through method overriding) behavior that can vary. * Avoid duplication in the code: the general workflow structure is implemented once in the abstract class's algorithm, and necessary variations are implemented in each of the subclasses. * Control at what point(s) subclassing is allowed. As opposed to a simple polymorphic override, where the base method would be entirely rewritten allowing radical change to the workflow, only the specific details of the workflow are allowed to change. From 3b4b80dc65b325e28c20abfd31d869c8ae1b7d43 Mon Sep 17 00:00:00 2001 From: Petrutiu Mihai Date: Thu, 14 Jul 2016 16:43:07 +0300 Subject: [PATCH 3/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 51acf7c..1265c22 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Patterns described: [8. Strategy pattern](https://github.com/MihaiTheCoder/BehavioralPatterns/blob/master/README.md#8-strategy-pattern) -[9. Template method pattern](https://github.com/MihaiTheCoder/BehavioralPatterns/blob/master/README.md#9-template-pattern) +[9. Template method pattern](https://github.com/MihaiTheCoder/BehavioralPatterns/blob/master/README.md#9-template-method-pattern) [10 Visitor pattern](https://github.com/MihaiTheCoder/BehavioralPatterns/blob/master/README.md#10-visitor-pattern)