diff --git a/README.md b/README.md index 4724ea332..4715c3b9b 100644 --- a/README.md +++ b/README.md @@ -6,26 +6,23 @@ [![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) -![Build status](https://travis-ci.org/iluwatar/java-design-patterns.svg?branch=master) [![Coverage Status](https://coveralls.io/repos/iluwatar/java-design-patterns/badge.svg?branch=master)](https://coveralls.io/r/iluwatar/java-design-patterns?branch=master) +[![Build status](https://travis-ci.org/iluwatar/java-design-patterns.svg?branch=master)](https://travis-ci.org/iluwatar/java-design-patterns) [![Coverage Status](https://coveralls.io/repos/iluwatar/java-design-patterns/badge.svg?branch=master)](https://coveralls.io/r/iluwatar/java-design-patterns?branch=master) Coverity Scan Build Status -#### Browse and view all of the patterns on our Website: [iluwatar.github.io/java-design-patterns/](https://iluwatar.github.io/java-design-patterns/) - # Table of Contents - Introduction + - How to contribute - Frequently Asked Questions - - How to contribute - - Versioning - Credits - License -## Introduction +# Introduction [↑](#top) Design patterns are formalized best practices that the programmer can use to solve common problems when designing an application or system. @@ -38,6 +35,11 @@ problems, and it also improves code readability for coders and architects who are familiar with the patterns. +# How to contribute [↑](#top) + +If you are willing to contribute to the project you will find the relevant information in our [developer wiki](https://github.com/iluwatar/java-design-patterns/wiki). + + # Frequently asked questions [↑](#top) **Q: What is the difference between State and Strategy patterns?** @@ -97,98 +99,6 @@ blocked waiting for available object from the pool. This is not the case with Flyweight. - -# How to contribute [↑](#top) - -**To work on a new pattern** you need to do the following steps: - -1. If there is no issue for the new pattern yet, raise new issue. Comment on - the issue that you are working on it so that others don't start work on the - same thing. -2. Fork the repository. -3. Create a new folder for the pattern. The rough structure of the new folder would be as follows: - * etc (every resource related to the pattern, like diagrams) - * src (the source code of the pattern) - * index.md (the description of the pattern) - * pom.xml (the maven pom.xml) -4. Implement the code changes in your fork. Remember to add sufficient comments - documenting the implementation. Reference the issue id e.g. #52 in your - commit messages. -5. Format the code according to [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html) - * [Eclipse configuration](https://github.com/google/styleguide/blob/gh-pages/eclipse-java-google-style.xml) - * [IntelliJ configuration](https://github.com/google/styleguide/blob/gh-pages/intellij-java-google-style.xml) -6. Create a simple class diagram from your example code and put it inside of the etc folder. -7. Add description of the pattern in index.md and link to the class diagram. - (Attention, all internal links must be relative to the pattern subdirectory, else the links dont link properly on the website) -8. Create a pull request. - -**Structure of the index.md file** - -```markdown ---- # this is so called 'Yaml Front Matter', read up on it here: http://jekyllrb.com/docs/frontmatter/ -layout: pattern # layout must allways be pattern -title: Best Pattern Ever # the properly formatted title -folder: best-pattern-ever # the folder name in which this pattern lies -permalink: /patterns/best-pattern-ever/ # the permalink to the pattern, to keep this uniform please stick to /patterns/FOLDER/ - -# both categories and tags are Yaml Lists -# you can either just pick one or write a list with '-'s -# usable categories and tags are listed here: https://github.com/iluwatar/java-design-patterns/blob/gh-pages/_config.yml -categories: creational # categories of the pattern -tags: # tags of the pattern - - best - - ever - - awesome ---- - -**Intent:** Makes your code awesome - -![alt text](./etc/best_pattern.png "Best Pattern Ever") - -**Applicability:** Use the Best Pattern Ever pattern when - -* you want to be the best -* you need to ... - -**Real world examples:** - -* [Nowhere](http://no.where.com) -``` - -**To add a new category or tag** you need to edit the _config.yml file of the gh-pages branch. -In there you should find 2 yaml lists with the respective names 'category-list' and 'tag-list' - -**To work on one of the non-pattern issues** you need to do the following steps: - -1. Check that the issue has "help wanted" badge -2. Comment on the issue that you are working on it -3. Fork the repository. -4. Implement the code changes in your fork. Remember to add sufficient comments - documenting the implementation. Reference the issue id e.g. #52 in your - commit messages. -5. Create a pull request. - -**For creating/editing UML diagrams** you need [ObjectAid UML Explorer for Eclipse](http://www.objectaid.com/home). - -**For inspiration** check out the following sources: - -* there is a good list of design patterns at [Wikipedia](http://en.wikipedia.org/wiki/Software_design_pattern) -* Martin Fowler's [Catalog of Patterns of Enterprise Application Architecture](http://martinfowler.com/eaaCatalog/) -* [pattern language for microservices](http://microservices.io/patterns/index.html) -* Microsoft's [Cloud Design Patterns](http://download.microsoft.com/download/B/B/6/BB69622C-AB5D-4D5F-9A12-B81B952C1169/CloudDesignPatternsBook-PDF.pdf) - -**Links to patterns applied in real world applications** are welcome. The links -should be added to the corresponding section of the `index.md`. - - -# Versioning [↑](#top) - -Java-design-patterns project uses [semantic versioning](http://semver.org/) -scheme. However, version numbers in this project do not signify binary releases -(since we don't make any) but rather milestones achieved on the roadmap. In -other words, version numbers are used only for project planning sake. - - # Credits [↑](#top) * [Design Patterns: Elements of Reusable Object-Oriented Software](http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612) @@ -196,21 +106,11 @@ other words, version numbers are used only for project planning sake. * [Java Generics and Collections](http://www.amazon.com/Java-Generics-Collections-Maurice-Naftalin/dp/0596527756/) * [Let's Modify the Objects-First Approach into Design-Patterns-First](http://edu.pecinovsky.cz/papers/2006_ITiCSE_Design_Patterns_First.pdf) * [Pattern Languages of Program Design](http://www.amazon.com/Pattern-Languages-Program-Design-Coplien/dp/0201607344/ref=sr_1_1) -* [Martin Fowler - Event Aggregator](http://martinfowler.com/eaaDev/EventAggregator.html) -* [TutorialsPoint - Intercepting Filter](http://www.tutorialspoint.com/design_pattern/intercepting_filter_pattern.htm) * [Presentation Tier Patterns](http://www.javagyan.com/tutorials/corej2eepatterns/presentation-tier-patterns) * [Functional Programming in Java: Harnessing the Power of Java 8 Lambda Expressions](http://www.amazon.com/Functional-Programming-Java-Harnessing-Expressions/dp/1937785467/ref=sr_1_1) -* [Martin Fowler - Service Layer](http://martinfowler.com/eaaCatalog/serviceLayer.html) -* [Martin Fowler - Specifications](http://martinfowler.com/apsupp/spec.pdf) -* [Martin Fowler - Tolerant Reader](http://martinfowler.com/bliki/TolerantReader.html) -* [Trygve Reenskaug - Model-view-controller](http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) -* [Flux - Application architecture for building user interfaces](http://facebook.github.io/flux/) -* [Richard Pawson - Naked Objects](http://downloads.nakedobjects.net/resources/Pawson%20thesis.pdf) * [Patterns of Enterprise Application Architecture](http://www.amazon.com/Patterns-Enterprise-Application-Architecture-Martin/dp/0321127420) * [Spring Data](http://www.amazon.com/Spring-Data-Mark-Pollack/dp/1449323952/ref=sr_1_1) * [J2EE Design Patterns](http://www.amazon.com/J2EE-Design-Patterns-William-Crawford/dp/0596004273/ref=sr_1_2) -* [Marco Castigliego - Step Builder](http://rdafbn.blogspot.co.uk/2012/07/step-builder-pattern_28.html) -* [Douglas C. Schmidt and Charles D. Cranor - Half Sync/Half Async](http://www.cs.wustl.edu/~schmidt/PDF/PLoP-95.pdf) * [Pattern Oriented Software Architecture Vol I-V](http://www.amazon.com/Pattern-Oriented-Software-Architecture-Volume-Patterns/dp/0471958697) diff --git a/abstract-factory/pom.xml b/abstract-factory/pom.xml index 798093c01..ddb7e7b9d 100644 --- a/abstract-factory/pom.xml +++ b/abstract-factory/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 abstract-factory diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/App.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/App.java index d18f1abed..29e9272f6 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/App.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/App.java @@ -1,5 +1,6 @@ package com.iluwatar.abstractfactory; + /** * * The essence of the Abstract Factory pattern is a factory interface @@ -12,26 +13,61 @@ package com.iluwatar.abstractfactory; */ public class App { - /** - * Program entry point - * @param args command line arguments - */ - public static void main(String[] args) { - createKingdom(new ElfKingdomFactory()); - createKingdom(new OrcKingdomFactory()); - } + private King king; + private Castle castle; + private Army army; /** * Creates kingdom * @param factory */ - public static void createKingdom(KingdomFactory factory) { - King king = factory.createKing(); - Castle castle = factory.createCastle(); - Army army = factory.createArmy(); - System.out.println("The kingdom was created."); - System.out.println(king); - System.out.println(castle); - System.out.println(army); + public void createKingdom(final KingdomFactory factory) { + setKing(factory.createKing()); + setCastle(factory.createCastle()); + setArmy(factory.createArmy()); + } + + ElfKingdomFactory getElfKingdomFactory() { + return new ElfKingdomFactory(); + } + + OrcKingdomFactory getOrcKingdomFactory() { + return new OrcKingdomFactory(); + } + + King getKing(final KingdomFactory factory) { + return factory.createKing(); + } + + Castle getCastle(final KingdomFactory factory) { + return factory.createCastle(); + } + + Army getArmy(final KingdomFactory factory) { + return factory.createArmy(); + } + + public King getKing() { + return king; + } + + private void setKing(final King king) { + this.king = king; + } + + public Castle getCastle() { + return castle; + } + + private void setCastle(final Castle castle) { + this.castle = castle; + } + + public Army getArmy() { + return army; + } + + private void setArmy(final Army army) { + this.army = army; } } diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/Army.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/Army.java index 225331517..333b5c2cd 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/Army.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/Army.java @@ -7,4 +7,5 @@ package com.iluwatar.abstractfactory; */ public interface Army { + String getDescription(); } diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/Castle.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/Castle.java index 272a97bf3..0290cb67c 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/Castle.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/Castle.java @@ -7,4 +7,5 @@ package com.iluwatar.abstractfactory; */ public interface Castle { + String getDescription(); } diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfArmy.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfArmy.java index d77fe8ebd..410f46951 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfArmy.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfArmy.java @@ -7,9 +7,10 @@ package com.iluwatar.abstractfactory; */ public class ElfArmy implements Army { - @Override - public String toString() { - return "This is the Elven Army!"; - } + static final String DESCRIPTION = "This is the Elven Army!"; + @Override + public String getDescription() { + return DESCRIPTION; + } } diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfCastle.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfCastle.java index 5c2b2a62a..fe2e9a0e7 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfCastle.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfCastle.java @@ -7,9 +7,10 @@ package com.iluwatar.abstractfactory; */ public class ElfCastle implements Castle { - @Override - public String toString() { - return "This is the Elven castle!"; - } + static final String DESCRIPTION = "This is the Elven castle!"; + @Override + public String getDescription() { + return DESCRIPTION; + } } diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfKing.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfKing.java index df475a354..66571ee01 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfKing.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/ElfKing.java @@ -7,9 +7,10 @@ package com.iluwatar.abstractfactory; */ public class ElfKing implements King { + static final String DESCRIPTION = "This is the Elven king!"; + @Override - public String toString() { - return "This is the Elven king!"; + public String getDescription() { + return DESCRIPTION; } - } diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/King.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/King.java index 0b75dbb0a..c7b9a867c 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/King.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/King.java @@ -7,4 +7,5 @@ package com.iluwatar.abstractfactory; */ public interface King { + String getDescription(); } diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcArmy.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcArmy.java index d331252dc..108700511 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcArmy.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcArmy.java @@ -7,9 +7,10 @@ package com.iluwatar.abstractfactory; */ public class OrcArmy implements Army { - @Override - public String toString() { - return "This is the Orcish Army!"; - } + static final String DESCRIPTION = "This is the Orc Army!"; + @Override + public String getDescription() { + return DESCRIPTION; + } } diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcCastle.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcCastle.java index fd09d9c17..5012f9200 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcCastle.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcCastle.java @@ -7,9 +7,10 @@ package com.iluwatar.abstractfactory; */ public class OrcCastle implements Castle { - @Override - public String toString() { - return "This is the Orcish castle!"; - } + static final String DESCRIPTION = "This is the Orc castle!"; + @Override + public String getDescription() { + return DESCRIPTION; + } } diff --git a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcKing.java b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcKing.java index 5bae8f31b..a5657d4e4 100644 --- a/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcKing.java +++ b/abstract-factory/src/main/java/com/iluwatar/abstractfactory/OrcKing.java @@ -7,9 +7,10 @@ package com.iluwatar.abstractfactory; */ public class OrcKing implements King { +static final String DESCRIPTION = "This is the Orc king!"; + @Override - public String toString() { - return "This is the Orc king!"; + public String getDescription() { + return DESCRIPTION; } - } diff --git a/abstract-factory/src/test/java/com/iluwatar/abstractfactory/AppTest.java b/abstract-factory/src/test/java/com/iluwatar/abstractfactory/AppTest.java index 91db0a4be..78cdf8a44 100644 --- a/abstract-factory/src/test/java/com/iluwatar/abstractfactory/AppTest.java +++ b/abstract-factory/src/test/java/com/iluwatar/abstractfactory/AppTest.java @@ -1,18 +1,77 @@ package com.iluwatar.abstractfactory; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Before; import org.junit.Test; -import com.iluwatar.abstractfactory.App; - -/** - * - * Application test - * - */ public class AppTest { + private App app = new App();; + private KingdomFactory elfFactory; + private KingdomFactory orcFactory; + + @Before + public void setUp() { + elfFactory = app.getElfKingdomFactory(); + orcFactory = app.getOrcKingdomFactory(); + } + @Test - public void test() { - String[] args = {}; - App.main(args); + public void king() { + final King elfKing = app.getKing(elfFactory); + assertTrue(elfKing instanceof ElfKing); + assertEquals(ElfKing.DESCRIPTION, elfKing.getDescription()); + final King orcKing = app.getKing(orcFactory); + assertTrue(orcKing instanceof OrcKing); + assertEquals(OrcKing.DESCRIPTION, orcKing.getDescription()); + } + + @Test + public void castle() { + final Castle elfCastle = app.getCastle(elfFactory); + assertTrue(elfCastle instanceof ElfCastle); + assertEquals(ElfCastle.DESCRIPTION, elfCastle.getDescription()); + final Castle orcCastle = app.getCastle(orcFactory); + assertTrue(orcCastle instanceof OrcCastle); + assertEquals(OrcCastle.DESCRIPTION, orcCastle.getDescription()); + } + + @Test + public void army() { + final Army elfArmy = app.getArmy(elfFactory); + assertTrue(elfArmy instanceof ElfArmy); + assertEquals(ElfArmy.DESCRIPTION, elfArmy.getDescription()); + final Army orcArmy = app.getArmy(orcFactory); + assertTrue(orcArmy instanceof OrcArmy); + assertEquals(OrcArmy.DESCRIPTION, orcArmy.getDescription()); + } + + @Test + public void createElfKingdom() { + app.createKingdom(elfFactory); + final King king = app.getKing(); + final Castle castle = app.getCastle(); + final Army army = app.getArmy(); + assertTrue(king instanceof ElfKing); + assertEquals(ElfKing.DESCRIPTION, king.getDescription()); + assertTrue(castle instanceof ElfCastle); + assertEquals(ElfCastle.DESCRIPTION, castle.getDescription()); + assertTrue(army instanceof ElfArmy); + assertEquals(ElfArmy.DESCRIPTION, army.getDescription()); + } + + @Test + public void createOrcKingdom() { + app.createKingdom(orcFactory); + final King king = app.getKing(); + final Castle castle = app.getCastle(); + final Army army = app.getArmy(); + assertTrue(king instanceof OrcKing); + assertEquals(OrcKing.DESCRIPTION, king.getDescription()); + assertTrue(castle instanceof OrcCastle); + assertEquals(OrcCastle.DESCRIPTION, castle.getDescription()); + assertTrue(army instanceof OrcArmy); + assertEquals(OrcArmy.DESCRIPTION, army.getDescription()); } } diff --git a/adapter/pom.xml b/adapter/pom.xml index 8def28655..74a58de92 100644 --- a/adapter/pom.xml +++ b/adapter/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 adapter diff --git a/async-method-invocation/pom.xml b/async-method-invocation/pom.xml index 699258d93..2a5010b74 100644 --- a/async-method-invocation/pom.xml +++ b/async-method-invocation/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 async-method-invocation diff --git a/bridge/pom.xml b/bridge/pom.xml index 01bd26061..947fa2c60 100644 --- a/bridge/pom.xml +++ b/bridge/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 bridge diff --git a/builder/pom.xml b/builder/pom.xml index c5405d0c6..65997c9e6 100644 --- a/builder/pom.xml +++ b/builder/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 builder diff --git a/business-delegate/pom.xml b/business-delegate/pom.xml index 2a7e77e3c..482d59fab 100644 --- a/business-delegate/pom.xml +++ b/business-delegate/pom.xml @@ -6,7 +6,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 business-delegate diff --git a/callback/pom.xml b/callback/pom.xml index d54b76172..f8cf6babf 100644 --- a/callback/pom.xml +++ b/callback/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 callback diff --git a/chain-of-responsibility/index.md b/chain/index.md similarity index 87% rename from chain-of-responsibility/index.md rename to chain/index.md index cf56fe3c6..25e14bf06 100644 --- a/chain-of-responsibility/index.md +++ b/chain/index.md @@ -1,8 +1,8 @@ --- layout: pattern title: Chain of responsibility -folder: chain-of-responsibility -permalink: /patterns/chain-of-responsibility/ +folder: chain +permalink: /patterns/chain/ categories: Behavioral tags: Java --- @@ -11,7 +11,7 @@ tags: Java more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it. -![alt text](./chain/etc/chain_1.png "Chain of Responsibility") +![alt text](./etc/chain_1.png "Chain of Responsibility") **Applicability:** Use Chain of Responsibility when diff --git a/chain/pom.xml b/chain/pom.xml index f4a712260..ebae620d6 100644 --- a/chain/pom.xml +++ b/chain/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 chain diff --git a/command/pom.xml b/command/pom.xml index 10bc00f0c..401acba32 100644 --- a/command/pom.xml +++ b/command/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 command diff --git a/composite/pom.xml b/composite/pom.xml index 4c910e451..ca4daaaad 100644 --- a/composite/pom.xml +++ b/composite/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 composite diff --git a/dao/pom.xml b/dao/pom.xml index 6653741e4..a7a5c74ca 100644 --- a/dao/pom.xml +++ b/dao/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 dao diff --git a/decorator/pom.xml b/decorator/pom.xml index 1b93a171c..57946b711 100644 --- a/decorator/pom.xml +++ b/decorator/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 decorator diff --git a/dependency-injection/pom.xml b/dependency-injection/pom.xml index 70300b617..a6780cb20 100644 --- a/dependency-injection/pom.xml +++ b/dependency-injection/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 dependency-injection diff --git a/double-checked-locking/pom.xml b/double-checked-locking/pom.xml index 21eb281c6..46d4a70f0 100644 --- a/double-checked-locking/pom.xml +++ b/double-checked-locking/pom.xml @@ -3,7 +3,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 double-checked-locking diff --git a/double-dispatch/pom.xml b/double-dispatch/pom.xml index 0d7462486..5f16635f6 100644 --- a/double-dispatch/pom.xml +++ b/double-dispatch/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 double-dispatch diff --git a/event-aggregator/index.md b/event-aggregator/index.md index fd42e9811..1c89c7188 100644 --- a/event-aggregator/index.md +++ b/event-aggregator/index.md @@ -23,3 +23,7 @@ allowing clients to register with just the aggregator. with them all, you can centralize the registration logic to the Event Aggregator. As well as simplifying registration, a Event Aggregator also simplifies the memory management issues in using observers. + +**Credits:** + +* [Martin Fowler - Event Aggregator](http://martinfowler.com/eaaDev/EventAggregator.html) diff --git a/event-aggregator/pom.xml b/event-aggregator/pom.xml index 90f488729..1c9a3b626 100644 --- a/event-aggregator/pom.xml +++ b/event-aggregator/pom.xml @@ -4,7 +4,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 event-aggregator diff --git a/execute-around/pom.xml b/execute-around/pom.xml index d8d41f5d8..7d806337b 100644 --- a/execute-around/pom.xml +++ b/execute-around/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 execute-around diff --git a/facade/pom.xml b/facade/pom.xml index 53ac6fd67..17d3d707c 100644 --- a/facade/pom.xml +++ b/facade/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 facade diff --git a/factory-method/pom.xml b/factory-method/pom.xml index 1812b006d..81072a4f9 100644 --- a/factory-method/pom.xml +++ b/factory-method/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 factory-method diff --git a/flux/index.md b/flux/index.md index c96b2b56a..227237168 100644 --- a/flux/index.md +++ b/flux/index.md @@ -17,3 +17,7 @@ logic, which updates all of the views that are affected. **Applicability:** Use the Flux pattern when * you want to focus on creating explicit and understandable update paths for your application's data, which makes tracing changes during development simpler and makes bugs easier to track down and fix. + +**Credits:** + +* [Flux - Application architecture for building user interfaces](http://facebook.github.io/flux/) diff --git a/flux/pom.xml b/flux/pom.xml index 367598fa2..3efccbfa4 100644 --- a/flux/pom.xml +++ b/flux/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 flux diff --git a/flyweight/index.md b/flyweight/index.md index 699c1ed54..85fa54ad1 100644 --- a/flyweight/index.md +++ b/flyweight/index.md @@ -15,6 +15,7 @@ efficiently. **Applicability:** The Flyweight pattern's effectiveness depends heavily on how and where it's used. Apply the Flyweight pattern when all of the following are true + * an application uses a large number of objects * storage costs are high because of the sheer quantity of objects * most object state can be made extrinsic diff --git a/flyweight/pom.xml b/flyweight/pom.xml index 87903217c..54ca5bef2 100644 --- a/flyweight/pom.xml +++ b/flyweight/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 flyweight diff --git a/front-controller/pom.xml b/front-controller/pom.xml index d0fcc001f..a554186f3 100644 --- a/front-controller/pom.xml +++ b/front-controller/pom.xml @@ -6,7 +6,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 front-controller diff --git a/half-sync-half-async/index.md b/half-sync-half-async/index.md index afeb20037..0ea0254b8 100644 --- a/half-sync-half-async/index.md +++ b/half-sync-half-async/index.md @@ -26,3 +26,7 @@ degrading execution efficiency. * [BSD Unix networking subsystem](http://www.cs.wustl.edu/~schmidt/PDF/PLoP-95.pdf) * [Real Time CORBA](http://www.omg.org/news/meetings/workshops/presentations/realtime2001/4-3_Pyarali_thread-pool.pdf) * [Android AsyncTask framework](http://developer.android.com/reference/android/os/AsyncTask.html) + +**Credits:** + +* [Douglas C. Schmidt and Charles D. Cranor - Half Sync/Half Async](http://www.cs.wustl.edu/~schmidt/PDF/PLoP-95.pdf) diff --git a/half-sync-half-async/pom.xml b/half-sync-half-async/pom.xml index edbc2e420..94c12d797 100644 --- a/half-sync-half-async/pom.xml +++ b/half-sync-half-async/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 half-sync-half-async diff --git a/intercepting-filter/index.md b/intercepting-filter/index.md index 66cf04b62..9625e445d 100644 --- a/intercepting-filter/index.md +++ b/intercepting-filter/index.md @@ -17,3 +17,7 @@ post-processing to requests from a client to a target * a system uses pre-processing or post-processing requests * a system should do the authentication/ authorization/ logging or tracking of request and then pass the requests to corresponding handlers * you want a modular approach to configuring pre-processing and post-processing schemes + +**Credits:** + +* [TutorialsPoint - Intercepting Filter](http://www.tutorialspoint.com/design_pattern/intercepting_filter_pattern.htm) diff --git a/intercepting-filter/pom.xml b/intercepting-filter/pom.xml index b4b5db5ae..35ebd9f59 100644 --- a/intercepting-filter/pom.xml +++ b/intercepting-filter/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 intercepting-filter diff --git a/interpreter/index.md b/interpreter/index.md index 40030917a..c7c4539d5 100644 --- a/interpreter/index.md +++ b/interpreter/index.md @@ -16,5 +16,6 @@ language. **Applicability:** Use the Interpreter pattern when there is a language to interpret, and you can represent statements in the language as abstract syntax trees. The Interpreter pattern works best when + * the grammar is simple. For complex grammars, the class hierarchy for the grammar becomes large and unmanageable. Tools such as parser generators are a better alternative in such cases. They can interpret expressions without building abstract syntax trees, which can save space and possibly time * efficiency is not a critical concern. The most efficient interpreters are usually not implemented by interpreting parse trees directly but by first translating them into another form. For example, regular expressions are often transformed into state machines. But even then, the translator can be implemented by the Interpreter pattern, so the pattern is still applicable diff --git a/interpreter/pom.xml b/interpreter/pom.xml index f2778e0cd..8583464d3 100644 --- a/interpreter/pom.xml +++ b/interpreter/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 interpreter diff --git a/iterator/pom.xml b/iterator/pom.xml index b77939c9d..da5040dce 100644 --- a/iterator/pom.xml +++ b/iterator/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 iterator diff --git a/layers/pom.xml b/layers/pom.xml index dd036e74c..de672a3df 100644 --- a/layers/pom.xml +++ b/layers/pom.xml @@ -6,7 +6,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 com.iluwatar.layers layers diff --git a/lazy-loading/pom.xml b/lazy-loading/pom.xml index cbbafae14..b795abf87 100644 --- a/lazy-loading/pom.xml +++ b/lazy-loading/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 lazy-loading diff --git a/mediator/pom.xml b/mediator/pom.xml index 2f3f83ff5..5a9c00042 100644 --- a/mediator/pom.xml +++ b/mediator/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 mediator diff --git a/memento/pom.xml b/memento/pom.xml index ccc2bd1e2..182a46204 100644 --- a/memento/pom.xml +++ b/memento/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 memento diff --git a/message-channel/.gitignore b/message-channel/.gitignore new file mode 100644 index 000000000..b83d22266 --- /dev/null +++ b/message-channel/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/message-channel/etc/message-channel.png b/message-channel/etc/message-channel.png new file mode 100644 index 000000000..7db473281 Binary files /dev/null and b/message-channel/etc/message-channel.png differ diff --git a/message-channel/etc/message-channel.ucls b/message-channel/etc/message-channel.ucls new file mode 100644 index 000000000..3ef0ed4bc --- /dev/null +++ b/message-channel/etc/message-channel.ucls @@ -0,0 +1,320 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/message-channel/index.md b/message-channel/index.md new file mode 100644 index 000000000..b5fb1761a --- /dev/null +++ b/message-channel/index.md @@ -0,0 +1,21 @@ +--- +layout: pattern +title: Message Channel +folder: message-channel +permalink: /patterns/message-channel/ +categories: Integration +tags: Java +--- + +**Intent:** When two applications communicate using a messaging system they do it by using logical addresses +of the system, so called Message Channels. + +![alt text](./etc/message-channel.png "Message Channel") + +**Applicability:** Use the Message Channel pattern when + +* two or more applications need to communicate using a messaging system + +**Real world examples:** + +* [akka-camel](http://doc.akka.io/docs/akka/snapshot/scala/camel.html) diff --git a/message-channel/pom.xml b/message-channel/pom.xml new file mode 100644 index 000000000..ef66f2401 --- /dev/null +++ b/message-channel/pom.xml @@ -0,0 +1,27 @@ + + + 4.0.0 + + com.iluwatar + java-design-patterns + 1.6.0 + + message-channel + + + org.apache.camel + camel-core + + + org.apache.camel + camel-stream + + + junit + junit + test + + + diff --git a/message-channel/src/main/java/com/iluwatar/message/channel/App.java b/message-channel/src/main/java/com/iluwatar/message/channel/App.java new file mode 100644 index 000000000..f9a334a8a --- /dev/null +++ b/message-channel/src/main/java/com/iluwatar/message/channel/App.java @@ -0,0 +1,53 @@ +package com.iluwatar.message.channel; + +import org.apache.camel.CamelContext; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.impl.DefaultCamelContext; + +/** + * + * When two applications communicate with each other using a messaging system + * they first need to establish a communication channel that will carry the + * data. Message Channel decouples Message producers and consumers. + *

+ * The sending application doesn't necessarily know what particular application + * will end up retrieving it, but it can be assured that the application that + * retrieves the information is interested in that information. This is because + * the messaging system has different Message Channels for different types of + * information the applications want to communicate. When an application sends + * information, it doesn't randomly add the information to any channel available; + * it adds it to a channel whose specific purpose is to communicate that sort of + * information. Likewise, an application that wants to receive particular information + * doesn't pull info off some random channel; it selects what channel to get information + * from based on what type of information it wants. + *

+ * In this example we use Apache Camel to establish two different Message Channels. The first + * one reads from standard input and delivers messages to Direct endpoint. The second Message + * Channel is established from the Direct component to console output. No actual messages are sent, + * only the established routes are printed to standard output. + * + */ +public class App { + + /** + * Program entry point + * @param args command line args + * @throws Exception + */ + public static void main(String[] args) throws Exception { + CamelContext context = new DefaultCamelContext(); + + context.addRoutes(new RouteBuilder() { + + @Override + public void configure() throws Exception { + from("stream:in").to("direct:greetings"); + from("direct:greetings").to("stream:out"); + } + }); + + context.start(); + context.getRoutes().stream().forEach((r) -> System.out.println(r)); + context.stop(); + } +} diff --git a/message-channel/src/test/java/com/iluwatar/message/channel/AppTest.java b/message-channel/src/test/java/com/iluwatar/message/channel/AppTest.java new file mode 100644 index 000000000..fa3af1161 --- /dev/null +++ b/message-channel/src/test/java/com/iluwatar/message/channel/AppTest.java @@ -0,0 +1,17 @@ +package com.iluwatar.message.channel; + +import org.junit.Test; + +/** + * + * Application test + * + */ +public class AppTest { + + @Test + public void test() throws Exception { + String[] args = {}; + App.main(args); + } +} diff --git a/model-view-controller/index.md b/model-view-controller/index.md index 5a12bc656..f96daf243 100644 --- a/model-view-controller/index.md +++ b/model-view-controller/index.md @@ -17,3 +17,7 @@ display. **Applicability:** Use the Model-View-Controller pattern when * you want to clearly separate the domain data from its user interface representation + +**Credits:** + +* [Trygve Reenskaug - Model-view-controller](http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) diff --git a/model-view-controller/pom.xml b/model-view-controller/pom.xml index 3a9167f5e..7162c71d9 100644 --- a/model-view-controller/pom.xml +++ b/model-view-controller/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 model-view-controller diff --git a/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/App.java b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/App.java new file mode 100644 index 000000000..0b74f4b5a --- /dev/null +++ b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/App.java @@ -0,0 +1,29 @@ +package com.iluwatar.model.view.controller.with.observer; + +/** + * + * In this second example the model-view relationship is different. This time we use the Observer pattern to notify + * the {@link GiantView} each time the {@link GiantModel} is changed. This way the {@link GiantController} responsibilities + * are narrowed and it only needs to modify the {@link GiantModel} according to the user input. + * + */ +public class App { + + /** + * Program entry point + * @param args command line args + */ + public static void main( String[] args ) { + // create model, view and controller + GiantModel giant = new GiantModel(Health.HEALTHY, Fatigue.ALERT, Nourishment.SATURATED); + GiantView view = new GiantView(); + GiantController controller = new GiantController(giant, view); + // initial display + controller.updateView(); + // controller receives some interactions that affect the giant + // model modifications trigger the view rendering automatically + controller.setHealth(Health.WOUNDED); + controller.setNourishment(Nourishment.HUNGRY); + controller.setFatigue(Fatigue.TIRED); + } +} diff --git a/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/Fatigue.java b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/Fatigue.java new file mode 100644 index 000000000..301a579fb --- /dev/null +++ b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/Fatigue.java @@ -0,0 +1,22 @@ +package com.iluwatar.model.view.controller.with.observer; + +/** + * + * Fatigue enumeration + * + */ +public enum Fatigue { + + ALERT("alert"), TIRED("tired"), SLEEPING("sleeping"); + + private String title; + + Fatigue(String title) { + this.title = title; + } + + @Override + public String toString() { + return title; + } +} diff --git a/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/GiantController.java b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/GiantController.java new file mode 100644 index 000000000..e892b2946 --- /dev/null +++ b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/GiantController.java @@ -0,0 +1,46 @@ +package com.iluwatar.model.view.controller.with.observer; + +/** + * + * GiantController updates the giant model. + * + */ +public class GiantController { + + private GiantModel giant; + private GiantView view; + + public GiantController(GiantModel giant, GiantView view) { + this.giant = giant; + this.view = view; + this.giant.registerObserver(this.view); + } + + public Health getHealth() { + return giant.getHealth(); + } + + public void setHealth(Health health) { + this.giant.setHealth(health); + } + + public Fatigue getFatigue() { + return giant.getFatigue(); + } + + public void setFatigue(Fatigue fatigue) { + this.giant.setFatigue(fatigue); + } + + public Nourishment getNourishment() { + return giant.getNourishment(); + } + + public void setNourishment(Nourishment nourishment) { + this.giant.setNourishment(nourishment); + } + + public void updateView() { + this.view.displayGiant(giant); + } +} diff --git a/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/GiantModel.java b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/GiantModel.java new file mode 100644 index 000000000..84b32a50a --- /dev/null +++ b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/GiantModel.java @@ -0,0 +1,63 @@ +package com.iluwatar.model.view.controller.with.observer; + +import java.util.ArrayList; +import java.util.List; + +/** + * + * GiantModel contains the giant data. + * + */ +public class GiantModel { + + private Health health; + private Fatigue fatigue; + private Nourishment nourishment; + private List observers = new ArrayList<>(); + + GiantModel(Health health, Fatigue fatigue, Nourishment nourishment) { + this.health = health; + this.fatigue = fatigue; + this.nourishment = nourishment; + } + + public Health getHealth() { + return health; + } + + public void setHealth(Health health) { + this.health = health; + notifyObservers(); + } + + public Fatigue getFatigue() { + return fatigue; + } + + public void setFatigue(Fatigue fatigue) { + this.fatigue = fatigue; + notifyObservers(); + } + + public Nourishment getNourishment() { + return nourishment; + } + + public void setNourishment(Nourishment nourishment) { + this.nourishment = nourishment; + notifyObservers(); + } + + @Override + public String toString() { + return String.format("The giant looks %s, %s and %s.", health, fatigue, nourishment); + } + + public void registerObserver(GiantModelObserver observer) { + observers.add(observer); + } + + private void notifyObservers() { + observers.stream().forEach((GiantModelObserver o) -> o.modelChanged(this)); + } +} diff --git a/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/GiantModelObserver.java b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/GiantModelObserver.java new file mode 100644 index 000000000..6363ef4f7 --- /dev/null +++ b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/GiantModelObserver.java @@ -0,0 +1,12 @@ +package com.iluwatar.model.view.controller.with.observer; + +/** + * + * GiantModelObserver is the interface for delivering update notifications. + * + */ +public interface GiantModelObserver { + + void modelChanged(GiantModel model); + +} diff --git a/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/GiantView.java b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/GiantView.java new file mode 100644 index 000000000..f4cebad80 --- /dev/null +++ b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/GiantView.java @@ -0,0 +1,18 @@ +package com.iluwatar.model.view.controller.with.observer; + +/** + * + * GiantView displays the giant + * + */ +public class GiantView implements GiantModelObserver { + + public void displayGiant(GiantModel giant) { + System.out.println(giant); + } + + @Override + public void modelChanged(GiantModel model) { + displayGiant(model); + } +} diff --git a/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/Health.java b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/Health.java new file mode 100644 index 000000000..e4b8ed9a7 --- /dev/null +++ b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/Health.java @@ -0,0 +1,22 @@ +package com.iluwatar.model.view.controller.with.observer; + +/** + * + * Health enumeration + * + */ +public enum Health { + + HEALTHY("healthy"), WOUNDED("wounded"), DEAD("dead"); + + private String title; + + Health(String title) { + this.title = title; + } + + @Override + public String toString() { + return title; + } +} diff --git a/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/Nourishment.java b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/Nourishment.java new file mode 100644 index 000000000..c1a8253c3 --- /dev/null +++ b/model-view-controller/src/main/java/com/iluwatar/model/view/controller/with/observer/Nourishment.java @@ -0,0 +1,22 @@ +package com.iluwatar.model.view.controller.with.observer; + +/** + * + * Nourishment enumeration + * + */ +public enum Nourishment { + + SATURATED("saturated"), HUNGRY("hungry"), STARVING("starving"); + + private String title; + + Nourishment(String title) { + this.title = title; + } + + @Override + public String toString() { + return title; + } +} diff --git a/model-view-controller/src/test/java/com/iluwatar/model/view/controller/with/observer/AppTest.java b/model-view-controller/src/test/java/com/iluwatar/model/view/controller/with/observer/AppTest.java new file mode 100644 index 000000000..9a43ce7bc --- /dev/null +++ b/model-view-controller/src/test/java/com/iluwatar/model/view/controller/with/observer/AppTest.java @@ -0,0 +1,19 @@ +package com.iluwatar.model.view.controller.with.observer; + +import org.junit.Test; + +import com.iluwatar.model.view.controller.with.observer.App; + +/** + * + * Application test + * + */ +public class AppTest { + + @Test + public void test() { + String[] args = {}; + App.main(args); + } +} diff --git a/model-view-presenter/index.md b/model-view-presenter/index.md index 6b0994077..609c59c13 100644 --- a/model-view-presenter/index.md +++ b/model-view-presenter/index.md @@ -14,5 +14,6 @@ developers to build and test user interfaces. **Applicability:** Use the Model-View-Presenter in any of the following situations + * when you want to improve the "Separation of Concerns" principle in presentation logic * when a user interface development and testing is necessary. diff --git a/model-view-presenter/pom.xml b/model-view-presenter/pom.xml index 5277e57ab..41a2d2013 100644 --- a/model-view-presenter/pom.xml +++ b/model-view-presenter/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 model-view-presenter model-view-presenter diff --git a/multiton/pom.xml b/multiton/pom.xml index 8f1220119..6ea1ad2fa 100644 --- a/multiton/pom.xml +++ b/multiton/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 multiton diff --git a/naked-objects/dom/pom.xml b/naked-objects/dom/pom.xml index 620efa9d7..cadf6d82e 100644 --- a/naked-objects/dom/pom.xml +++ b/naked-objects/dom/pom.xml @@ -16,7 +16,7 @@ com.iluwatar naked-objects - 1.5.0 + 1.6.0 naked-objects-dom diff --git a/naked-objects/fixture/pom.xml b/naked-objects/fixture/pom.xml index b0146e84e..33cd798f7 100644 --- a/naked-objects/fixture/pom.xml +++ b/naked-objects/fixture/pom.xml @@ -16,7 +16,7 @@ com.iluwatar naked-objects - 1.5.0 + 1.6.0 naked-objects-fixture diff --git a/naked-objects/index.md b/naked-objects/index.md index cef2a9ede..805cea810 100644 --- a/naked-objects/index.md +++ b/naked-objects/index.md @@ -22,3 +22,7 @@ everything else is autogenerated by the framework. **Real world examples:** * [Apache Isis](https://isis.apache.org/) + +**Credits:** + +* [Richard Pawson - Naked Objects](http://downloads.nakedobjects.net/resources/Pawson%20thesis.pdf) diff --git a/naked-objects/integtests/pom.xml b/naked-objects/integtests/pom.xml index f479896cc..1fd518bb1 100644 --- a/naked-objects/integtests/pom.xml +++ b/naked-objects/integtests/pom.xml @@ -16,7 +16,7 @@ com.iluwatar naked-objects - 1.5.0 + 1.6.0 naked-objects-integtests diff --git a/naked-objects/pom.xml b/naked-objects/pom.xml index 8860815af..8cac48a09 100644 --- a/naked-objects/pom.xml +++ b/naked-objects/pom.xml @@ -15,7 +15,7 @@ java-design-patterns com.iluwatar - 1.5.0 + 1.6.0 naked-objects @@ -350,17 +350,17 @@ ${project.groupId} naked-objects-dom - 1.5.0 + 1.6.0 ${project.groupId} naked-objects-fixture - 1.5.0 + 1.6.0 ${project.groupId} naked-objects-webapp - 1.5.0 + 1.6.0 diff --git a/naked-objects/webapp/pom.xml b/naked-objects/webapp/pom.xml index 9873589c7..3e018995a 100644 --- a/naked-objects/webapp/pom.xml +++ b/naked-objects/webapp/pom.xml @@ -16,7 +16,7 @@ com.iluwatar naked-objects - 1.5.0 + 1.6.0 naked-objects-webapp diff --git a/null-object/pom.xml b/null-object/pom.xml index dfa1c6891..eec32fd4d 100644 --- a/null-object/pom.xml +++ b/null-object/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 null-object diff --git a/object-pool/pom.xml b/object-pool/pom.xml index 3226bf71c..4a3b237c6 100644 --- a/object-pool/pom.xml +++ b/object-pool/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 object-pool diff --git a/observer/pom.xml b/observer/pom.xml index 49a484edf..19e93421c 100644 --- a/observer/pom.xml +++ b/observer/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 observer diff --git a/poison-pill/pom.xml b/poison-pill/pom.xml index c3a5e46c1..2a0653981 100644 --- a/poison-pill/pom.xml +++ b/poison-pill/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 poison-pill diff --git a/pom.xml b/pom.xml index ce298d61b..68cfab646 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 pom @@ -17,6 +17,7 @@ 3.1.0 0.7.2.201409121644 1.4 + 2.15.3 abstract-factory @@ -71,10 +72,11 @@ front-controller repository async-method-invocation - business-delegate - half-sync-half-async + business-delegate + half-sync-half-async step-builder layers + message-channel reactor @@ -105,6 +107,16 @@ commons-dbcp ${commons-dbcp.version} + + org.apache.camel + camel-core + ${camel.version} + + + org.apache.camel + camel-stream + ${camel.version} + junit junit diff --git a/private-class-data/pom.xml b/private-class-data/pom.xml index 6e6817621..70a716062 100644 --- a/private-class-data/pom.xml +++ b/private-class-data/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 private-class-data diff --git a/property/pom.xml b/property/pom.xml index 6b0511fe0..5435f06f5 100644 --- a/property/pom.xml +++ b/property/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 property diff --git a/prototype/pom.xml b/prototype/pom.xml index 39d8b7d33..0ebba706e 100644 --- a/prototype/pom.xml +++ b/prototype/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 prototype diff --git a/proxy/pom.xml b/proxy/pom.xml index 560c456b8..1f625d736 100644 --- a/proxy/pom.xml +++ b/proxy/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 proxy diff --git a/repository/pom.xml b/repository/pom.xml index fe3ca4c0d..db0a8af5f 100644 --- a/repository/pom.xml +++ b/repository/pom.xml @@ -6,7 +6,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 repository diff --git a/resource-acquisition-is-initialization/pom.xml b/resource-acquisition-is-initialization/pom.xml index fb965ca2d..c8382ceb8 100644 --- a/resource-acquisition-is-initialization/pom.xml +++ b/resource-acquisition-is-initialization/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 resource-acquisition-is-initialization diff --git a/servant/pom.xml b/servant/pom.xml index b59a470f2..b6497215f 100644 --- a/servant/pom.xml +++ b/servant/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 servant diff --git a/service-layer/index.md b/service-layer/index.md index 22afc1669..f9e7ac1cb 100644 --- a/service-layer/index.md +++ b/service-layer/index.md @@ -20,3 +20,7 @@ its business logic. The Service Layer fulfills this role. * you want to encapsulate domain logic under API * you need to implement multiple interfaces with common logic and data + +**Credits:** + +* [Martin Fowler - Service Layer](http://martinfowler.com/eaaCatalog/serviceLayer.html) diff --git a/service-layer/pom.xml b/service-layer/pom.xml index 96e4e6dbf..8e0ea8322 100644 --- a/service-layer/pom.xml +++ b/service-layer/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 service-layer diff --git a/service-locator/pom.xml b/service-locator/pom.xml index 6b287242e..a596e4b0c 100644 --- a/service-locator/pom.xml +++ b/service-locator/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 service-locator diff --git a/singleton/pom.xml b/singleton/pom.xml index dfb5cff82..cdd9b613a 100644 --- a/singleton/pom.xml +++ b/singleton/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 singleton diff --git a/specification/index.md b/specification/index.md index 2609f50e5..6b76d5102 100644 --- a/specification/index.md +++ b/specification/index.md @@ -18,3 +18,7 @@ order * you need to select a subset of objects based on some criteria, and to refresh the selection at various times * you need to check that only suitable objects are used for a certain role (validation) + +**Credits:** + +* [Martin Fowler - Specifications](http://martinfowler.com/apsupp/spec.pdf) diff --git a/specification/pom.xml b/specification/pom.xml index 53e92fef1..b4d6efe90 100644 --- a/specification/pom.xml +++ b/specification/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 specification diff --git a/state/pom.xml b/state/pom.xml index e9178d0ae..0119146b3 100644 --- a/state/pom.xml +++ b/state/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 state diff --git a/step-builder/index.md b/step-builder/index.md index 636504598..766479358 100644 --- a/step-builder/index.md +++ b/step-builder/index.md @@ -13,3 +13,7 @@ The user experience will be much more improved by the fact that he will only see ![alt text](./etc/step-builder.png "Step Builder") **Applicability:** Use the Step Builder pattern when the algorithm for creating a complex object should be independent of the parts that make up the object and how they're assembled the construction process must allow different representations for the object that's constructed when in the process of constructing the order is important. + +**Credits:** + +* [Marco Castigliego - Step Builder](http://rdafbn.blogspot.co.uk/2012/07/step-builder-pattern_28.html) diff --git a/step-builder/pom.xml b/step-builder/pom.xml index 8466266a7..f9c98474b 100644 --- a/step-builder/pom.xml +++ b/step-builder/pom.xml @@ -6,7 +6,7 @@ java-design-patterns com.iluwatar - 1.5.0 + 1.6.0 step-builder diff --git a/strategy/pom.xml b/strategy/pom.xml index c24ccf9af..9532a8079 100644 --- a/strategy/pom.xml +++ b/strategy/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 strategy diff --git a/template-method/pom.xml b/template-method/pom.xml index b0063c79e..53a7dc56e 100644 --- a/template-method/pom.xml +++ b/template-method/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 template-method diff --git a/thread-pool/pom.xml b/thread-pool/pom.xml index 21f0bad3d..42e54de7e 100644 --- a/thread-pool/pom.xml +++ b/thread-pool/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 thread-pool diff --git a/tolerant-reader/index.md b/tolerant-reader/index.md index 7e0ef4f32..b2bfd376a 100644 --- a/tolerant-reader/index.md +++ b/tolerant-reader/index.md @@ -17,3 +17,7 @@ changes, the readers must not break. **Applicability:** Use the Tolerant Reader pattern when * the communication schema can evolve and change and yet the receiving side should not break + +**Credits:** + +* [Martin Fowler - Tolerant Reader](http://martinfowler.com/bliki/TolerantReader.html) diff --git a/tolerant-reader/pom.xml b/tolerant-reader/pom.xml index fb28424d4..7e852d4ee 100644 --- a/tolerant-reader/pom.xml +++ b/tolerant-reader/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 tolerant-reader diff --git a/visitor/pom.xml b/visitor/pom.xml index a420b3269..8adda4855 100644 --- a/visitor/pom.xml +++ b/visitor/pom.xml @@ -5,7 +5,7 @@ com.iluwatar java-design-patterns - 1.5.0 + 1.6.0 visitor