MVC reduction programming complexity With object-oriented languages (such as Java) rapid development and popularity, more and more programmers began to use these languages in application development. However, the original development language (ie, an operational development language such as C , etc.) is not likely to exit the historical stage in a short time, so there is now a situation in which object-oriented language and traditional operational coexistence. Simultaneous use of two different languages in design applications (mixed language design) brings many new problems than in the past, with complexity is the most frequent problems in mixed language design. Below we explore where mixed language can lead to increased complexity, and how to reduce these complexity. Complex complexity is a problem that is the most distracted in the application development process. Whenever a function is added to an application, its complexity is usually geometric growth. This complexity often leads to the development of the program to continue. This is also why many applications have only Beta versions without official version. Experts divide the complexity of the application development process into two types, namely non-essential and essential. The complexity of essence is the complexity that is necessarily generated by solving the target problem, and non-essentially complexity is due to the complexity of the inappropriate development tools and design tools. For programs determined by a function, the complexity of the nature is determined, and the complexity of the nature is not limited. Therefore, the development of an application should be successfully succeeded, and it is necessary to reduce non-essential complexity as much as possible. OOD features object-oriented design (OOD) decomposes a program into a series of elements designed according to specific objects. The behavior and data of these specific objects are packaged in a programming unit called "class". The application creates an exemplary example of one or more of these classes, also known as "object". The behavior of the class is combined by creating a relationship between objects. OOD allows developers to control the increase in complexity with two main methods. First, OOD defines a strict export semantic, which allows developers to hide the details of the implementation, and clearly explain what methods can be accessed by other objects. This information hides such that most of the code can be modified without affecting other objects. Second, OOD divides the relationship between objects into four categories: inheritance, inclusion, use and coordination. Appropriate use of these relationships can greatly reduce the essence of nature and non - intrinsic complexity during application development. For example, inheritance is the main factor in the object-oriented design. This reuse is obtained by code sharing and polymorphism. This reuse can greatly reduce the complexity of the nature of the application. Accessibility allows a class to ignore the included class (Class) when using the container. This simplification makes designers to greatly reduce the non-essential complexity of the application. Insufficient visual interfaces in OOD, many programs require visual interface, which are composed of dialogs, menu, toolbar, and the like. The increase in these visual interfaces will introduce the lack of OOD design, so that a good object-oriented design is reversed. Three attributes in the visual interface may cause trouble to apply development. First, the visual interface improves the traditional-oriented topology. The user generates interface events such as switch buttons and list box selection, etc., driven by one module of the program and is used to operate static data. In the design, the same-oriented topology is mixed with object-oriented design, which will result in a large amount of hybrid between the objects. Second, the user interface usually requires many different displays for the same information. For example, a customer selection list box can contain a customer's name and phone number and the name of many other customers. When a user chooses a particular customer, he / her name and phone number and other related information will be displayed in detail. In addition, a simple program may have different user interfaces.
If a bank account system has an interface to visit the account balance, deposits, and withdrawals, and the supervisor's interface contains additional information and adds the function of the account management. These different interfaces can easily lead to extensions of the class. Finally, the visual interface will also make a large change in the entire design phase. These changes include complete rearrangement of user interactions with the system. These changes of visual interfaces will increase the complexity of application development even in the best design. MVC Repairing the Insufficient Model / Interface / Controller (MVC) programming technology allows a developer to connect a visual interface to an object-oriented design, while also avoiding our discussion above Several questions. MVC was originally designed for SmallTalk language. MVC Separates object-oriented design with visual interfaces by creating the following three layers: Model: The model contains all behaviors and data required to complete the task. The model is typically composed of many classes and uses object-oriented technologies to create programs that meet five design objectives. Interface (view): An interface is a program visual element such as dialog, menu, toolbar, and more. The interface displays the data provided from the model, which does not control data or provides other behaviors except the display. A single program or model typically has two interface behaviors. Controller: The controller maps the model into the interface. The controller handles the user's input, and each interface has a controller. It is a state machine that receives user input, creates or modify the appropriate model object and will modify the state machine embodied in the interface. The controller is also responsible for creating other interfaces and controllers when needed. Controllers have always decided which interfaces and model components should be active at a given moment, which has been responsible for receiving and processing user input, any variations from user input are sent from the controller to the model. The interface displays data from the object within the model. Changes of these objects can be accomplished or not by the user's interaction. Such as: In a web browser, you must have information in the object collection and fitting stack in a web browser. You must have some way to let these objects notify the interface data has been changed. There are two ways to update the interface when the model changes. In the first method, the interface can tell the model which object is being monitored. When any one of these objects changes, one information is sent to the interface. The interface receives this information and updates accordingly. In order to avoid the shortcomings of our discussion above, models must be able to support many different interfaces without modifications. The second method does not directly connect the interface to the model, and its controller is responsible for updating the interface when the model changes. The controller detects the changes in the model by monitoring the model object or the observer method. This method does not have to understand the model knowledge of the interface, so the interface is to be used across applications. Advantage of using MVC MVC eliminates most of the difficulties related to user interfaces and object-oriented design: First, the controller tracks and processs operationally oriented user events through a state machine. This allows the controller to create and destroy objects from the model when necessary, and isolate the action-oriented topology and the object-oriented design. This isolation helps prevent the object-oriented design to go back. Second, MVC separates the user interface to the object-oriented model. This allows the same model to use many different interface display modes without modification. In addition, if the model update is completed by the controller, the interface can be reused across the application. Finally, the MVC allows the application's user interface to make large changes without affecting the model. The change in each user interface will only need to modify the controller, but since the controller contains little actual behavior, it is easy to modify. Object-oriented designers must be very careful when adding a visual interface to an object-oriented design, because the viewing topology of the visual interface can greatly increase the complexity of the design.