"Bonjour, soldat !"
"Félicitations pour l'amélioration de vos compétences. Nous avons besoin de gars prêts à tout."
"Je suis sûr que vous avez encore de nombreuses tâches inachevées. Il est temps d'en terminer quelques-unes !"
26
Mission
Java Multithreading, niveau 4, leçon 14
MVC (part 1)
Hi! This task will cover the Model-View-Controller (MVC) pattern.
Together we are going to build an MVC architecture. Dive in deep to understand why you need to implement it the way that I show you.
You'll probably be asked about this pattern in an interview or will be given a task that will require you to implement it.
7
Mission
Java Multithreading, niveau 4, leçon 14
MVC (part 2)
1. Create a controller package, and create a Controller class inside it.
This class will receive requests from the client and notify the Model. The Model, in turn, will update the DataModel.
2. Add a Model model field, along with a setter, to the controller.
26
Mission
Java Multithreading, niveau 4, leçon 14
MVC (part 3)
To understand whether you're heading in the right direction, you need to see the data. Therefore,
1. In the view package, create a UsersView class that implements View. It will display the list of users.
2. Create a controller field, and a corresponding setter, in UsersView.
13
Mission
Java Multithreading, niveau 4, leçon 14
MVC (part 4)
It's time to replace our fake Model with a real one that receives data from the DataSource.
I've added a service for working with users to the model.service package.
You'll also find a Util utility class in the root of this task.
1. Create a MainModel by analogy with FakeModel.
13
Mission
Java Multithreading, niveau 4, leçon 14
MVC (part 5)
The service has a method that returns all deleted users. Let's display them.
1. Assign each of these methods to the correct MVC classes.
26
Mission
Java Multithreading, niveau 4, leçon 14
MVC (part 6)
The functionality for displaying deleted users exists, but we don't have any deleted users. Let's fix that.
Let's make a new view that will be responsible for editing a specific user.
UsersView displays a list of users.
EditUserView will display data about editing a specific user.
26
Mission
Java Multithreading, niveau 4, leçon 14
MVC (part 7)
1. Assign each of these methods to the correct MVC classes.
26
Mission
Java Multithreading, niveau 4, leçon 14
MVC (part 8)
1. Following the MVC pattern, do the following by analogy with how the previous methods were implemented:
write the logic for deleting a user. After a deletion operation, the list of users must be displayed.
Assign the following methods to MVC classes.
7
Mission
Java Multithreading, niveau 4, leçon 14
MVC (part 9)
This is the last task on MVC.
1. Following the MVC pattern, do the following by analogy with how the previous methods were implemented:
write the logic for updating a user. After the update operation, the list of users must be displayed.
Assign the following methods to MVC classes.