From d3fcb6a76e20bf00607a9cd2d9ac28afc5befa57 Mon Sep 17 00:00:00 2001 From: Christoph Kroczek Date: Sat, 13 Jul 2019 21:12:53 +0200 Subject: [PATCH] item01 updated --- effectivejava/item001/README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 effectivejava/item001/README.md diff --git a/effectivejava/item001/README.md b/effectivejava/item001/README.md new file mode 100644 index 0000000..4ee1d69 --- /dev/null +++ b/effectivejava/item001/README.md @@ -0,0 +1,20 @@ +# About this kata +This kata refers to the book Effective Java by Joshua Bloch. +It addresses + +Item 1: Consider static factory methods instead of constructors. + +# Problem description +Provid a class that +Use factory method to construct an instance by a good understandable name. +The instance shall be only created when there is no existing one. + +advantages of factory method usage instead of constructors: +# Unlike constructors the method has a meaningful name. +# Unlike constructors it is not required to create a new object each time they are invoked. +# Unlike constructors it can return an object of any subtype of their return type. +# The returned object can vary from call to call as function of the input parameters. +# The class of the returned object need not exist when the class containing the method is written. ???? + + +# Clues