From 9180bb0fef1ab7369cb07298c16c99a4ca86d14f Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 14 Nov 2016 16:43:58 +0100 Subject: [PATCH] Update App.java The relationship between decorator and target (in the code example between Troll und SmartTroll) ist not a composition as described in the code comment lines of class App. It's a aggregation. In a composition both instances canncot live without the other one. But the target (Troll) could live without the decorator (Smart Troll). Changed "composition" to "aggregation" in the comment lines. Code lines are unchanged. Greetings Thomas --- decorator/src/main/java/com/iluwatar/decorator/App.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/decorator/src/main/java/com/iluwatar/decorator/App.java b/decorator/src/main/java/com/iluwatar/decorator/App.java index bdc574fbc..5cb5a7155 100644 --- a/decorator/src/main/java/com/iluwatar/decorator/App.java +++ b/decorator/src/main/java/com/iluwatar/decorator/App.java @@ -25,7 +25,7 @@ package com.iluwatar.decorator; /** * * The Decorator pattern is a more flexible alternative to subclassing. The Decorator class - * implements the same interface as the target and uses composition to "decorate" calls to the + * implements the same interface as the target and uses aggregation to "decorate" calls to the * target. Using the Decorator pattern it is possible to change the behavior of the class during * runtime. *