C # Three-tier Architecture project experience (1)

Source: Internet
Author: User

Recently in the study of three-layer architecture, there are some things themselves have some of their own feelings, want to find a place to write down, found in the blog park I have not applied to open a blog, and then only here to write down some, after some feelings, will also write down.

First of all, at the beginning of the three layer of the time I feel that is not an application is divided into three different levels of the relationship between each other to coordinate the implementation of the application, perhaps, I understand this is not wrong, but later in the study of C # Foundation, found that, in fact, not only this, The three-tier architecture makes this effect, but its intrinsic idea is to achieve the three main features of object-oriented: encapsulation, inheritance and polymorphism.

In layer three, different implementations are categorized with different functions by using different levels, and there is only a reference relationship between them, which is the feature of the object-oriented encapsulation: the operation of different functions and features can be encapsulated in a class-like way, accessible only through certain interfaces or other It is like a company under a certain department, and departments and departments only when the need for cooperation, there are specific people to interact with each other. When it comes to this, I think of some things in software engineering, there is a basic design concept: high cohesion, low coupling and modularization. Modularity is the ability to separate something that needs to be implemented into a single module that can be implemented in a cooperative way by these modules. and high cohesion, low coupling is on the basis of the modularity of the deep, high cohesion is the module inside to converge tightly, low coupling is the module and the module as much as possible to a little bit of interaction. And the three-layer architecture to achieve this idea, but not very perfect, although in three layers in the addition of a layer of model layer, but it is still some imperfect feeling, but I still do not analyze, of course, I now touch only some fur, you may find it later.

In terms of inheritance and polymorphism, I'm now only using interfaces for parameter passing when I'm passing parameters, while others try to pass parameters using a public property, but it doesn't feel good. Polymorphic words, in a word, object-oriented, nowhere is not polymorphic, the nature of the object comes from life, and the class is also the object of the common characteristics of the results of the extraction, polymorphism more refers to the behavior of polymorphism, an operation, different sub-class objects of their respective responses.

To talk about our three layer, the essence of the operation is to the data in the database to make additions and deletions to check and change.

Operations on data in a database are essentially requests, processes, and responses. The client requests the server, the server processes the request, and responds. But the essence of request, process, and response is to invoke the method, the request is to invoke the method and pass the parameters, and the processing is to invoke the method body of the method to perform the operation, and the response is to return the return value.

Here I also learned that the operation of the database most of the time is to be careful, especially to add and remove this can change the data in the database operation, once the modification error, will be irreversible and cause immeasurable loss, so in the company's data operation requires daily backup. Another point is that data is hard to come by, and it is best to use "soft delete" when deleting data, and to mark the data if it has been deleted.

  

C # Three-tier Architecture project experience (1)

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.