Architecture to improve program reusability ~ First, the reusability of the system is inseparable from the system's object-oriented nature.

Source: Internet
Author: User

Sorry, it took so long for everyone to wait for the first lecture of this series to begin. Haha, after the directory is written, it is explained one by one according to the directory, I have shared my development experience with you.

Today, we mainly talk about "the reusability of the system is inseparable from the object-oriented nature of the system". We may feel that we have used a period of time to develop a project.CodeBlock, which is also used in another project. The common practice is Ctrl + C, and then Ctrl + v, the bad thing is "No worries". Why?

Easy: because it does not need to be considered, it is only implemented for implementation, and this is certainly not recommended, because people who use this method to program, I will never realize the fun of it. I may just work for my salary.

No worries: InProgramIn the test phase, engineers suddenly found that the code you copied has a problem, which may be a performance problem, a business problem, or a business problem ..., there is a problem, so what will happen to you as a responsible programmer? Of course, it is changed one by one. It is also Ctrl + C, CTRL + V, but at this time, you must regret it again. It is better to abstract the block code, the method, the class, or the project.

 

Today, to reuse the system, you must first abstract the system, that is, your system code must conform to the object-oriented features, in this series, I will use the recently developed "general background system" as an example to tell you

Four Solution Folders are used in this system. Let's talk about them separately.

One project. Common Folder: it provides a public project for all projects and does not depend on the project set of other projects,

 

Onlinepayment: Related to the payment function module

Standard

Vcommons: related to public function libraries

Vconfig: Global Public configuration information

Project 2. core Folder: it is an abstraction of the N-layer model. It abstracts core public code of the Web (UI), Entity (model), data (DAL), and other layers, form a collection of projects irrelevant to the field,

Data. commons: abstraction of the data layer. In this example, we use LINQ to SQL as the underlying Orm, which is also applicable to entity frameworks.

Entity. commons: abstraction of the entity layer. In this example, all the entities are extensions of native entities of LINQ to SQL. Thanks to Microsoft's partial keyword and the object assignment is tracked.

Web. commons: abstraction of the web layer. In this example, the style of the standard MVC mode is used to abstract the controller and abstract the common features, such as login verification.

Three Common. background Folder: it is an abstraction of the standard background management system, including the most basic background Foundation, management of users, menus, permissions, departments, and other modules, it applies to all background projects,

Common. Background. Data: The implementation of the background data layer, which inherits from data. commons

Common. Background. entity: The implementation of the background entity layer, which inherits from entity. commons

Common. Background. Service: The implementation of the background business layer, which processes the most basic business logic

Common. Background. Web. controllers: The implementation of the background UI Layer, which inherits from web. commons

4. Personalized project folder. This is a real project related to the field. It has its own architecture standards,

We can see that it is also a standard three-tier architecture. The front-end and back-end public data and entity layers, the project is relatively simple, and the service layer is not used.

Through a real project explanation, do you have a clear understanding of how to improve the reusability of the program? Haha!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.