Practice of one-time invoicing Software Architecture (I) -- Overview
1. Structure
Based on experience, we can find that an interface is always one piece. Each piece contains some basic controls (such as buttons, text boxes, and date controls), as well as a grid control and tree control, if each block is called a region, it becomes an item. In this way, we can abstract the interface into two base classes: Region and item, the other regions derived from the region are used to create the editing area, grid area, and tree area. The items in the editing area are created by the Type attribute in the item class using the branch statement.
Then there are different types of forms that contain different regions. Then we add an appearance class, which has an attribute to store all the regions and define various possible regions from the class derived from the appearance. The location and other information of each region are performed by the form.
These classes also have other responsibilities. The classes derived from the appearance are responsible for interaction among regions, and the regions are responsible for data binding, fixed events, and data initialization, item also has the responsibility of data binding. The appearance class has many responsibilities, and the main responsibility is the operation mechanism.
In fact, I didn't think like this in the first place. I wanted various controls to be created, bound, verified, and authorized in a uniform way, so I thought of having a base class to abstract them, an item is available, but a single item cannot complete a complex interface, so the step-by-step thinking is structured as described above.
2. Operating Mechanism
Here we will briefly list what to do during running.
1. Pre-initialization
Some initial value settings and validity verification have decided whether to continue and so on must be placed before the form is opened.
2. load data
Load data to dataset data attributes of the appearance class using the interface method implemented by the business object in the appearance class.
3. initialize Permissions
Set some attributes related to data in the database in the permission object.
4. Create appearance
In this case, the controls in the form are created.
5. Initialization Verification
With the same initialization permissions, my authentication and permissions use the same classes, and I abstracted them into the same thing. Referring to the MIS system architecture, this is complicated, but I am not going to mention it. A mb. jsevaluator. dll is used to complete the dynamic conditional expression.
6. End Initialization
7. Bind data