Java Reference
In-Depth Information
Application Architecture
In the Java literature, many different models or architectures have been proposed to handle the most common types
of Java applications. One of the most popular is the MVC ( Model-View-Controller ) architecture. MVC dictates that
any Java class should only perform functions from one of the three MVC categories.
For instance, classes that are part of the Model perform application business logic and/or maintain the
application's data. If data needs to be stored or retrieved, only classes in the Model access the database. The View
classes gather input (data and instructions) from the user and format and display the application results. The
Controller classes receive input via the View and invoke those portions of the Model and View to perform the user
requested functions and display the results.
Throughout this text, you have been gently guided toward the MVC architecture. For instance, in the client-based
application, the frame classes were separated from the application logic classes. In addition, there was always a Java
class that kicked off the application. These are the three components of the MVC architecture. The Employee class
performed the application logic (the Model). The EmployeeFrame displayed the results (the View). The user ran
EmployeeApp (the Controller), which created an Employee object (the Model) and the EmployeeFrame object
(the View) where the employee data was displayed. When we created EnterEmpInfo, we were trying to expand the
view to have a new input portion.
Figure 9-15 shows the basic structure of the MVC architecture and Figure 9-16 shows how the client-based
application (with the EnterEmpInfo frame) “sort of ” fits into the MVC architecture.
Figure 9-15.
 
Search WWH ::




Custom Search