This article for Bo Master original, allow reprint, but please declare the original address: http://www.coselding.cn/blog/4/4-117.html
- Business Rep Mode: (query selection method for different implementations of the same interface)
Steps:
- Business interface;
- Business interface implementation, multiple;
- The query class implemented by the business interface implements the corresponding interface implementation class according to the keyword;
- Business representative: Maintain a business query class and a business interface reference, keyword settings, execution method in accordance with the keyword to obtain a business implementation class reference, and use the business to perform the corresponding functions;
- Business representatives can achieve the appropriate business processing through the business representative, and need to implement the set of keywords.
- Combining Entity Patterns: (attribute integrity in complex entities read-write, maintain data consistency)
Steps:
- Create dependent objects;
- Create coarse-grained objects, maintain the references of multiple dependent objects internally, and complete the corresponding SetData and GetData methods to read and write the data in the dependent objects as a whole;
- Create composite entity objects, control references to multiple coarse-grained objects, and read and write all data in the same way as coarse-grained objects;
- The caller reads and writes the data in the composite entity object as a whole.
- < Span style= "margin:0px; padding:0px; border:0px; outline:0px; Vertical-align:baseline; font-family: Microsoft ya black; Background:transparent "> Data Access Object mode: (is DAO mode)
step:
implement additions and deletions to an entity, where the query can have all queries and a single query
- Front-end controller mode:
Used for authentication/authorization/logging, and processing requests, returned to the user corresponding interface, is used to process all requests of the total controller.
Steps:
- Scheduler: Select the corresponding interface output through keywords;
- Front Controller: Authentication, request recording, authorization, and select the corresponding interface output through the scheduler
- Block Filter Mode:
Steps:
- Filter interface and filter method;
- Filter interface Implementation;
- Filter Chain: Maintain filter set, delete method, Execute method, execute all filters before executing target code;
- Filter Management class: Control the implementation of the filter chain;
- Requestor class: Invokes the filter manager to execute the request.
- Service Locator Mode:
Querying a service with Jndi is expensive, caches the service after the first query, and gets the service directly from the cache the next time it improves performance.
Steps:
- Cache class Caches: maintains a collection of services, queries the service through the keyword, does not query the return NULL, and the service is added (to ensure the uniqueness of the service in the collection);
- Service Locator class: maintain a cache class reference, through the keyword query service, first check the cache, if the cache is not again through the Jndi Query service, and the service into the cache.
- Transfer Object mode:
Implements the transport functionality of the entity's server client, using serialization and deserialization methods.
- Encapsulates an object entity, and the properties are serializable;
- Reads data from the database to populate the entity;
- Serialization of entities to the client;
- The client deserializes the original entity object and completes the object network transmission function.
This article for Bo Master original, allow reprint, but please declare the original address: http://www.coselding.cn/blog/4/4-117.html
Common design Patterns in a project