File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed
mediator/src/main/java/com/iluwatar/mediator Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change 22
33/**
44 *
5- * Mediator encapsulates how a set of objects ({@link PartyMember}) interact. Instead of
6- * referring to each other directly they use a mediator ({@link Party}) interface.
5+ * The Mediator pattern defines an object that encapsulates how a set of objects
6+ * interact. This pattern is considered to be a behavioral pattern due to the way
7+ * it can alter the program's running behavior.
8+ * <p>
9+ * Usually a program is made up of a large number of classes. So the logic and
10+ * computation is distributed among these classes. However, as more classes are
11+ * developed in a program, especially during maintenance and/or refactoring,
12+ * the problem of communication between these classes may become more complex.
13+ * This makes the program harder to read and maintain. Furthermore, it can become
14+ * difficult to change the program, since any change may affect code in several
15+ * other classes.
16+ * <p>
17+ * With the Mediator pattern, communication between objects is encapsulated with
18+ * a mediator object. Objects no longer communicate directly with each other, but
19+ * instead communicate through the mediator. This reduces the dependencies between
20+ * communicating objects, thereby lowering the coupling.
21+ * <p>
22+ * In this example the mediator encapsulates how a set of objects ({@link PartyMember})
23+ * interact. Instead of referring to each other directly they use the mediator
24+ * ({@link Party}) interface.
725 *
826 */
927public class App {
You can’t perform that action at this time.
0 commit comments