Application of MVC mode in the test system (1)

xiaoxiao2021-03-06  36

MVC divides this application into three object types: Model: Maintaining data and provides data access methods. View: Partial data or all data of the model. Controller: Handling events.

Application (1)

Here, the MVC mode is mainly statistically of the answer sheet distribution, and statistics include the following: 1. Pass: 2. Did not pass; 3. Unreasonable: 4.

Everyone knows MVC

The structure is designed for applications that need to provide multiple views for the same data. There are two views here: one is a comparison chart (histogram), one is the answer to the answer sheet (pie chart) data Here, it is of course referring to the number of answers to the answer. To implement MVC, the most important part is the Observer mode in Design Pattern. Observer mode allows an object to notify multiple observer (Observer) when the observed object changes. Observer interface notifies multiple observes when modifying the observed object, usually between the observed and the observer There is a small interface, as follows: Public interface observer {public void data (model model);} This interface has a DataUpdate (model model), as long as this interface object is implemented, it has become an observer. Model MODEL

Create a data model, in my example, first build a data object: public class data {public pass // passed the test paper public no_pass // Unrocked test paper public no_evalute // Unreasonable test paper public no_turnin / / Unused test volume} now build a model: public class model {ArrayList Data = new arraylist (); arraylist observer = new arraylist (); public model () {super ();}}

转载请注明原文地址:https://www.9cbs.com/read-58444.html

New Post(0)