My project models is a simple client application that enables user to book airplane or coach travel. It uses model-view-controller architecture to achieve this in the most efficient way. For now, the application can run for only one user, but multiple user login can be achieved by running simple server application with all information about travels and registered users(this is my goal for the future). User of the program is able to communicate with program via graphical interface. Each of the events raised by the user(View), which is mostly a button click, generate the message that is handled by the ViewController(Controller) implementing all the logic connected with data retrieval. By means of the controller the application manages the resources stored in Model. Thus, preventing View from directly talking to the Model. Implementing MVC in Swing wasn't easy, because it doesn't serve convinient ways of two-way communication between objects. I modeled the Controller as ActionListener which then can be distributed to View objects. Each event generated by the user is signalled with actionPerfomed method. Controller responds to the source of the message by the object method, userLoggedIn() for example.
- singleton (ReservationSystem), because there should be only one system that manages user's orders and available travels
- observer (ViewController)
- bridge (ClientDatabase), hides the implementation of the database, only the methods from presented interface are used in the programm enabling replacing current implementation in the future
As the company using the application will grow, there can appear different possibilities of travel. For example the firm may be offering boat trips. Boat class can be easily implemented as extending already existing class MeanOfTransport. It can provide more services and details than MeanOfTransport class so additional methods and properties may be added.
Basic session with my application includes the following steps:
- Registration of the user
- Logging in
- Searching for desired travel
- Creating the order by selecting places in the transport vehicle
- (Optional) Managing the orders(removing unwanted)
- Paying for the orders
- (Optional) Editing profile information of user
cd transport-company && ./run_program.sh