[Reading Notes] agileppp-Design Mode

Source: Internet
Author: User
Tags nested switch
Command mode

Command mode

Active Object Mode

Is the application of command
Is the Basic Technology for implementing Multithreading
Application of active object concurrency mode in Java

Http://www.ibm.com/developerworks/cn/java/j-lo-activeobject/index.html

Template Method and Policy Mode

Why is combination inherited (or policy mode due to template method): the Policy mode has one more intermediate layer than the template method, and the policy mode fully complies with the dip principle, each specific policy is allowed to be manipulated by multiple general algorithms. template implementation relies on high-level modules, which partially violates dip, so that a specific implementation can only serve one general algorithm.

Singleton and monostate

Singleton
A class has only one instance.
A static member
A private default constructor
Monostate
A class has many instances, but each instance has the same status.
All members are static.

Null Object

Adapting to objects with behaviors is meaningless for pure pojo

Factory Mode

This mode is not required when creating a specific stable class, such as the string class.
This mode is useful when creating highly variable classes.
Two forms:
One class and one make Method
Using parameters to create objects based on parameters, the implementation class throws an exception when a parameter error occurs.

Composite Mode

Allows you to send multiple commands without changing existing customer classes.
Support one-to-one relationships

Observer Mode

Two Models
Push Model
Pull Model
The model used depends on the complexity of the object to be observed. if the object is complex, use push. Otherwise, use pull

Abstract Server Mode

Introduce an interface between the client and its dependent objects. The interface name is from the customer's perspective, and the interface belongs to its customers.
The logical binding relationship between a customer and an interface is stronger than that between an interface and its derived classes.
The strength of the logical relationship is inconsistent with that of the object relationship.

Adapter Mode

This mode is introduced when the customer code is not changed and new functions need to be supported, and new functions cannot directly implement the interfaces provided by the customer.
Modem example

Bridge Mode

The function of Bridge Mode: separates abstraction and implementation, enables independent development and free combination of abstraction and implementation, and increases the code reuse rate to curb explosive growth of classes.
See example: bridge mode instance-cup factory http://blog.csdn.net/yhmhappy2006/article/details/7230003

Visitor Mode

The visitor mode is an extension of the policy mode. It allows you to use policies for multiple classes in a class inheritance system. In general, if an application has a data structure that needs to be parsed/processed in multiple ways, you can use the visitor mode.

Acyclic visitor Mode

The visitor mode is suitable for systems with stable visitor hierarchies.
A variant of the visitor, removing the impact on the inherited structure of the visitor when a new visitor object is added.
The visitor interface is degraded, and the visit method is decomposed into various visitor-specific interfaces.

Implementation of Finite State Machine

Nested switch/case statements
Migration table
State Mode

State Mode


Each status implementation class represents the corresponding status
The method of the Status class indicates the event.
When an event is triggered, the current status class modifies the new status of the subject and triggers the corresponding action of the subject (so the status class must hold a reference pointing to the subject class)

Source code is the design document

Design:
Architecture Design
Module Design
Encoding
Build/test cycle
Software design process:
Architecture Design-> module design-> detailed design (coding)-> build/Test Loop-> design document (final Code)-> auxiliary design document (which is manually summarized based on the final code)

See: http://blog.csdn.net/yhmhappy2006/article/details/7234270

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.