diff --git a/front-controller/index.md b/front-controller/index.md index a462a08e0..bc8f38d9f 100644 --- a/front-controller/index.md +++ b/front-controller/index.md @@ -3,14 +3,14 @@ layout: pattern title: Front Controller folder: front-controller permalink: /patterns/front-controller/ -categories: Presentation Tier +categories: Creational tags: - Java - Difficulty-Intermediate --- ## Intent -Introduce a common handler for all requests for a web site. This +Introduce how to create objects which follow value semantics rather than reference semantics. way we can encapsulate common functionality such as security, internationalization, routing and logging in a single place. diff --git a/value-object/etc/value-object.png b/value-object/etc/value-object.png new file mode 100644 index 000000000..69a244c80 Binary files /dev/null and b/value-object/etc/value-object.png differ diff --git a/value-object/etc/value-object.ucls b/value-object/etc/value-object.ucls new file mode 100644 index 000000000..7bbf5e47c --- /dev/null +++ b/value-object/etc/value-object.ucls @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/value-object/index.md b/value-object/index.md new file mode 100644 index 000000000..8645a2384 --- /dev/null +++ b/value-object/index.md @@ -0,0 +1,34 @@ +--- +layout: pattern +title: Value Object +folder: value-object +permalink: /patterns/value-object/ +categories: Creational +tags: + - Java + - Difficulty-Beginner +--- + +## Intent +Provide objects which follow value semantics rather than reference semantics. +This means value objects' equality are not based on identity. Two value objects are +equal when they have the same value, not necessarily being the same object. + +![alt text](./etc/value-object.png "Value Object") + +## Applicability +Use the Value Object when + +* you need to measure the objects' equality based on the objects' value + +## Real world examples + +* [java.util.Date](https://docs.oracle.com/javase/8/docs/api/java/util/Date.html) +* [joda-time, money, beans](http://www.joda.org/) +* [JSR-310 / ThreeTen project LocalDate](http://www.threeten.org/articles/local-date.html) + +## Credits + +* [Patterns of Enterprise Application Architecture](http://www.martinfowler.com/books/eaa.html) +* [VALJOs - Value Java Objects : Stephen Colebourne's blog](http://blog.joda.org/2014/03/valjos-value-java-objects.html) +* [Value Object : Wikipedia](https://en.wikipedia.org/wiki/Value_object) diff --git a/value-object/value-object/pom.xml b/value-object/pom.xml similarity index 100% rename from value-object/value-object/pom.xml rename to value-object/pom.xml diff --git a/value-object/value-object/src/main/java/com/iluwatar/value/object/App.java b/value-object/src/main/java/com/iluwatar/value/object/App.java similarity index 100% rename from value-object/value-object/src/main/java/com/iluwatar/value/object/App.java rename to value-object/src/main/java/com/iluwatar/value/object/App.java diff --git a/value-object/value-object/src/main/java/com/iluwatar/value/object/HeroStat.java b/value-object/src/main/java/com/iluwatar/value/object/HeroStat.java similarity index 100% rename from value-object/value-object/src/main/java/com/iluwatar/value/object/HeroStat.java rename to value-object/src/main/java/com/iluwatar/value/object/HeroStat.java diff --git a/value-object/value-object/src/test/java/com/iluwatar/value/object/HeroStatTest.java b/value-object/src/test/java/com/iluwatar/value/object/HeroStatTest.java similarity index 100% rename from value-object/value-object/src/test/java/com/iluwatar/value/object/HeroStatTest.java rename to value-object/src/test/java/com/iluwatar/value/object/HeroStatTest.java