Three-tier + Design Mode

Source: Internet
Author: User

This is because I have already introduced three layers in the previous article. The main content of this article is how to implement the three layers + design mode. The first thing we need to do is add and add?

The basic purpose of Layer 3 is to decouple and separate layers so as to change one layer without affecting other layers as much as possible. Therefore, an abstract factory mode can be added to layer B and layer d to achieve this goal. For example:

Of course, you can also add other modes as appropriate. For example, you can add an appearance mode to the U and B layers. In general, this is what the table is in the package diagram.

In addition, there is a more important part, that is, the above implementation is also very easy, and it is the same as the design pattern without adding: one layer of invocation layer, of course, the simpler method is to figure out the timing sequence. The sequence diagram is as follows:

In the code, you must pay attention to the added design pattern, such as the implementation of the design pattern.

Conclusion: The above can draw a conclusion that the program development sequence is to plot the program first, rather than simply typing the program directly. Let's assume that we have made all the figures out and analyzed each step clearly. I wonder that it will be very good when I try to program. We usually take it directly and try it out. In fact, this is a bad habit, so we have to change it. We can only improve it in this way.

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.