From the course: Complete Guide to Java Design Patterns: Creational, Behavioral, and Structural
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Avoid tight coupling between objects - Java Tutorial
From the course: Complete Guide to Java Design Patterns: Creational, Behavioral, and Structural
Avoid tight coupling between objects
This app is an example of where objects are tightly coupled and would benefit from using the mediator pattern. It's an app for keeping track of tickets that developers are working on, and there are three main classes. The first one is the ticket class, so this class has a field of type assignee, which is the person who's working on the ticket. Then there's an enum called status, so a ticket can either be submitted, in progress, or done. And then there's a field to store the status. And you can see in the constructor that when you first create a ticket the status is set to submitted. Then there's a method to get the status and method to set the status, and a method to set the assignee. Next there's the board class. So this is the board where tickets are kept. There are two lists, one called inProgressTickets, which is an array list, and another array list called doneTickets. Then there's a method to get the done tickets, and there's a method called addTicketToInProgressTickets. So this…
Download courses and learn on the go
Watch courses on your mobile device without an internet connection. Download courses using your iOS or Android LinkedIn Learning app.
Contents
-
-
(Locked)
Understand abstract factories3m 7s
-
(Locked)
Recognize where to use abstract factories3m 53s
-
(Locked)
Create factories for families of objects6m 4s
-
(Locked)
Implement the complete Abstract Factory pattern6m 1s
-
(Locked)
Challenge: The Abstract Factory pattern1m 36s
-
(Locked)
Solution: The Abstract Factory pattern2m 34s
-
(Locked)
-
-
(Locked)
Understand the Chain of Responsibility pattern1m 23s
-
(Locked)
Recognize where to use the Chain of Responsibility pattern2m 35s
-
(Locked)
Implement a successor chain4m 49s
-
(Locked)
Challenge: The Chain of Responsibility pattern1m 48s
-
(Locked)
Solution: The Chain of Responsibility pattern3m 59s
-
(Locked)