In the interface frame, use theMVCdesign pattern is the most appropriate way. Why do you say that? BecauseMis aModelthe abbreviation means the meaning of the model. Models are algorithms, business logic, and business representations. This is often changed, for example, like a bank to develop a supermarket integration system, the different people to the store credit card to give different points, this is with different time will change, like the Mid-Autumn Festival when the purchase of mooncakes can add more points, the change is reflected in the model. Vis thatViewthe abbreviation, which is the view, is the interface for the user. The interface is stable for a certain period of time, but more interfaces are generated as the user needs change. For example, users can see the data list at the beginning of the display is very satisfied, when they have spent a period of time, will be able to provide a graph to describe the data? This is the requirement of the interface, that is, multi-view. In other words, a single piece of data corresponds to multiple views, and multiple views understand the data from different angles. With the model, and the view, it is possible to implement the data after the business logic processing in the view of the display, basically complete the entire software requirements. But user requirements for software, not only can see, but also need to interact. For example, when you see a curve, you want to zoom in to see the details, then you need to control it. The control section is abstracted asController, the abbreviation isC. To this,MVCthe duties of the three were very clear,MDescribe data logic processing,Vrepresents the data display after processing,Creceive user control and pass different controls to theMorV. Among them, the most special isMwith theVThere is no direct connection, the business logic processing does not care about how the interface is presented, it is only to achieve the optimization algorithm, or the most complex business logic, on the contrary, the interface does not need to care about the data is how to deal with, just according to user needs and display, while multiple views from the same data, Therefore, the display of multiple views is also guaranteed to be consistent.
With the above concept, it is necessary to practice, only practice can understand the theory, and understand more deeply. Especially in the software development work, did not write code, only see the theory, like standing on the shore to learn to swim, never learn to swim. Because people in the water and the shore feel very different, the density of water than empty density is not an order of magnitude, and the difference is particularly large. As a result, imagination is not going to get the real feeling. In terms of programming, too, it is difficult to understand the gap between imagination and fulfillment if you do not kiss handwritten code. It is often said that, like this feature is not a few lines of code, it takes two or three days to make a product. In fact, he said the product is only a demonstration of the current situation to achieve the product, rather than the actual available, maintainable, reusable, testable products. A software product in their eyes is only focused on usability, regardless of maintainability, reusability, and testability. Maintainability is an important indicator, if not maintained, a software product is difficult to succeed, because a software product life cycle is very long,Tenyear is short, in thisTenduring the year, different users add in, as well as the emergence of competitors, software products to upgrade is a common thing. How to make software PRODUCT updates faster, but also to the old user compatibility, not to change the moreBUGappear, this is a difficult thing to do. If the code does not consider maintainability, it becomes a task that is impossible to accomplish. Reusability is the cost of software development, which is key because the efficiency of software development determines the pricing of the product. It is the key factor that determines whether or not your product is winning the bid, usually in terms of price .50%The above role. Testable is the quality of the software, and whether the software can be maintained as an indicator. Because a software product development continues to achieveTenyear, every one months updated, but also compatible with the old products, old users, so how to ensure compatibility with the old products? Only for the old product regression testing, this regression test, if it is artificial, obviously not comprehensive, also not practical. As a result, automated testing is an inevitable choice, and only automated testing can be tested more fully to ensure that all aspects of the product conform to the original rules. and automated testing is more efficient than manual, enough to reduce costs.
MVC design Pattern