Skip to content

Commit dfc8e4e

Browse files
committed
Step 5: Lesson Learnt :-)
1 parent 69fa158 commit dfc8e4e

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

pattern/src/com/premaseem/Client.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ public static void main (String[] args) {
3939

4040
// Crisp, reusable, centralized code using factory
4141
IceCreamFactory iceCreamFactory = new IceCreamFactory();
42-
iceCreamFactory.createIceCream(iceCreamChoice);
42+
43+
// Virtual constructor ( takes care of configuration )
44+
iceCream = iceCreamFactory.createIceCream(iceCreamChoice);
4345

4446
// Repeatative code to even print
4547
// System.out.print("Ice cream of your choice is ");
@@ -54,5 +56,11 @@ public static void main (String[] args) {
5456
System.out.print("Ice cream of your choice is "+ iceCream.getIceCreamName());
5557
System.out.println(iceCream);
5658

59+
System.out.println("Lessons Learnt");
60+
System.out.println("Creation is easy and simplified with virtual constructor");
61+
System.out.println("Centralized code easy to maintain and extend");
62+
System.out.println("Loosely coupled code with interface");
63+
System.out.println("Polymorphism in full force");
64+
5765
}
5866
}

0 commit comments

Comments
 (0)