Model-Oriented Software Architecture 1-model system Reading Notes (3)-Design Model

Source: Internet
Author: User

Design Mode

Eight design modes: Whole-part, master-slave, proxy, command processor, and view processingProgram, Repeater-receiver, client-distributor-server, publisher-subscriber.

 

Design Pattern Classification:

1) Structured decomposition. The patterns contained in this category support the appropriate decomposition of subsystems and complex components into areas of mutual cooperation. Overall-some patterns are the most common patterns for some categories.

2) work organization. The patterns in this category define how components work together to solve complex problems. The master-slave mode facilitates the calculation of fault tolerance or computing accuracy required by services. It also supports splitting services into mutually independent parts and performing them in parallel.

3) access control. This mode protects and controls access to services or components. The proxy mode allows clients to communicate with representatives of components rather than with components themselves.

4) management. This category includes a pattern that processes similar object sets, similar service sets, and similar component sets as a whole. The command processor mode processes the management and protocol of user commands, while the view handler mode describes how to manage the view in a software system.

5) communication. Patterns in this category help to form communication between components. The forwarder-receiver mode processes peer-to-peer communication, and the client-distributor-server mode describes the location of transparent communication in a client-server structure. The publisher-subscriber mode helps partners maintain data consistency tasks.

 

Overall-partial Mode

The general principle of overall-partial mode applies to three types of links:

1) Assembly-part relationship, used to distinguish a product from its components or child accessories. All components are tightly integrated according to the assembled internal structure. The quantity and type of sub-accessories are defined in advance and cannot be changed.

2) container-content (container-contents) relationship, in which the aggregate object is expressed as a container, which is loose compared with the part in the Assembly-part relationship, you can even dynamically add or delete content.

3) collection-member relationship, which provides functions such as performing iterations on its members and performing operations on the members. Individual members of the collection are equal.

For external clients, only the overall service is visible. It also acts as a wrapper around its components to protect them from unauthorized access. Each part of the object is embedded in a whole. Two or more parts cannot share the same part. Each part is created or destroyed within its entire lifecycle.

 

 

Implementation

1) design the overall public interface. The overall analysis must be provided to the client. In this step, we only consider the client's point of view. Think of the whole as an atomic component that is not broken down into parts. Compile a list of common methods.

2) The entire decomposition part, or the synthesis from the existing part. There are two ways to aggregate the required parts-one is to aggregate the existing parts from the bottom up into a whole, and the other is to break down the whole from top to bottom into a small part:

· A bottom-up approach allows a whole composed of loosely coupled parts, which will be reused when other types are implemented in the future.

· The top-down method overwrites all the functions of the entire system. It is divided into parts because it is driven by the service provided by the entire client, avoiding the implementation of pasting.Code. However, strict application of top-down methods often results in tight coupling and cannot be reused in other contexts.

3) if the bottom-up method is used. Use existing parts of the component library or class library and describe the collaboration between them in detail. If the existing part cannot cover all functions, You need to describe the additional part and its integration with the remaining part in detail. You may need to use a top-down approach to implement these missing parts.

4) if the top-down method is used. The entire service is divided into small collaborative services, and these collaborative services are mapped to the separated parts.

5) use some services to describe the overall service in detail. In the structure established in the previous two steps, the whole is represented as a set of collaboration parts, which have independent responsibilities.

· If a client's request is forwarded to some services, some do not need to use any knowledge of the overall execution context and only need to rely on its own environment.

· The delegate method requires that the contextual information of the entire part be transmitted to the part. It is very useful when the part needs to be closely embedded in the overall environment.

6) implementation section. If the part itself is a whole-part structure, go to step 1 for Recursive Design. If not, reuse the existing parts from the database, or implement them only if they are straightforward and do not need further decomposition.

7) overall implementation. Implement the overall service based on the structure developed in the previous step, and implement services dependent on some objects by requesting their services from the whole, you must also implement services that do not depend on some objects in this step.

 

Advantages

1) partially changeable. The overall encapsulation section, so that its client cannot see these sections. This makes it possible to modify the overall internal structure without affecting the client. Some implementations will also be completely changed without having to modify other parts or clients.

2) Separation of transactions. A whole-some structures support the separation of transactions. Each transaction is implemented by a separate part. Therefore, it is easier to implement complicated policies by combining them with simple services as a single Integration Unit.

3) reusability. Overall-some models support reuse in two aspects. First, the whole part can be reused for other aggregate objects. Second, partial encapsulation in the whole prevents the client from using "dispersed" parts of objects in its source program.

 

Insufficient

1) Indirect behaviors reduce the efficiency. Because a layer of packaging is built around the entire part of it, it also introduces an indirect additional layer between a client request and the part that practices it.

2) decomposition is complicated. It is usually difficult to synthesize an appropriate whole from different parts, especially when the bottom-up method is used.

Related Article

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.