新浪微博 登陆  注册   设为首页 加入收藏

学PHP >> 设计模式与算法 >> 网络编程常用设计模式


查看次数25604 发表时间2012-10-08 23:13:50


Abstract Factory [GoF95] provides an interface for creating families of related or dependent objects without specifying their concrete classes.

Factory Method [GoF95] defines an interface for creating an object, but lets subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses.

Abstract Manager [Lieb01] focuses on the management of business objects in enterprise systems.

Activator [Stal00] helps to implement efficient on-demand activation and deactivation of services that are accessed by multiple clients.

Active Object [POSA2] decouples method execution from method invocation.

Adapter [GoF95] converts the interface of a class into an interface expected by clients. Adapter allows classes to work together that
could not do so otherwise because of incompatible interfaces.

Wrapper Facade [POSA2] encapsulates the functions and data provided by existing non-object-oriented APIs within more concise, robust, portable, maintainable, and cohesive object-oriented class interfaces.

Asynchronous Completion Token [POSA2] allows an application efficiently to demultiplex and process the responses of asynchronous operations it invokes on services.

Cache Management [Gran98] focuses on caching objects in Java and on how to combine a cache with the Manager [Somm98] pattern.

Cache Proxy [POSA1] implements caching inside a proxy that represents the data source from which one or multiple clients want to retrieve data.

[CoHa01] provides a means of interpreting differing objects as being the same in specific contexts. It does this by introducing an instance variable, the comparand, in each class of interest, and using it for comparison. Establishing the ‘sameness’ of differing objects is necessary when more than one reference refers conceptually to the same object.

Component Configurator [POSA2] allows an application to link and unlink its component implementations at run-time without having to modify, recompile, or statically relink the application.

Command Processor [POSA1] separates the request for a service from its execution. A command processor component manages requests as separate objects, schedules their execution, and provides additional services such as storing request objects for later undo.(http://www.vico.org/pages/PatronsDisseny/Pattern%20Command%20Processor/

Data Transfer Object [Fowl02] carries data, for example other objects or invocation parameters, between remote clients and servers. The encapsulation provided by this pattern reduces the number of remote operations required to transfer such data.

Deployer [Stal00] describes how to configure, deploy, and install software artifacts.

Disposal Method [Henn03] encapsulates the concrete details of object disposal by providing an explicit method for cleaning up objects, instead of abandoning the objects to be garbage collected or terminating them by deletion.

Double-Checked Locking Optimization [POSA2] reduces contention and synchronization overheads when critical sections of code must acquire locks in a thread-safe manner just once during program execution.

Fixed Allocation [NoWe00] allows memory consumption to be predicted by allocating the necessary memory at program initialization.

Flyweight [GoF95] uses sharing to support large numbers of fine-grained objects efficiently.

Half-Object Plus Protocol [Mesz95] divides the responsibilities of an object into halves and assigns them to two interdependent half-objects when an object is used by two distributed clients. For efficiency reasons, each half-object implements the responsibility that is most used locally. This pattern lets the half-objects coordinate themselves via some protocol.

Interceptor [POSA2] allows services to be added to a framework transparently and triggered automatically when specific events occur.

Lazy Load [Fowl02] defers the loading of data from databases until it is first accessed.

Virtual Proxy [GoF95] loads or constructs the object that the proxy represents on demand.
http://www.itarchitect.co.uk/pix/wiley/PatternOriented.pdf  applicable when loading image.

Lazy Optimization [Auer96] optimizes the performance of a piece of software only after the design has been correctly determined.

Lazy Propagator [FeTi97] describes how, in a network of dependent objects, objects can determine when they are affected by the state changes of other objects, and therefore need to update their state.
(Update when needed)

Lazy State
[MoOh97] defers the initialization of the state of an object [GoF95] until the state is accessed.

Manager [Somm98] places functionality that applies to all objects of a class into a separate management object. This separation allows the independent variation of management functionality and its reuse for different object classes.

[POSA1] supports fault tolerance, parallel computation and computational accuracy. A master component distributes work to identical slave components and computes a final result from the results returned by the slaves.

Mediator [GoF95] defines an object that encapsulates the way in which a set of objects interact. Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and allows their interaction to be varied independently.

Memento [GoF95] encapsulates the state of an object in a separate, persistable object.

Model-View-Controller [POSA1] divides an interactive application into three components. The model contains the core functionality and data, the view displays information to the user, and the controller handles user input. The view and controller together comprise the user interface. A change-propagation mechanism ensures consistency between the user interface and the model.

Object Lifetime Manager [LGS01] is specialized for the management of singleton objects in operating systems that do not support static destructors properly, such as real-time operating systems.

Object Pool
[Gran98] manages the reuse of objects of a type that is expensive to create, or of which only a limited number can be created.

Page Cache [TMQH+03] improves response times when dynamically-generated Web pages are accessed. A page cache is associated with a Web server that uses it to store accessed pages indexed by their URLs. When the same URL is requested, the Web server queries the cache and returns the cached page instead of dynamically generating its contents again.

[VSW02] persists and activates memory representations of component instances to and from persistent storage.
http://www.kircher-schwanninger.de/michael/publications/ieee_internet.pdf -- temporarily unused instances are removed from memory and stored in a persistent storage such as a database. Upon the next request, the instances are restored again.

Pooled Allocation [NoWe00] pre-allocates a pool of memory blocks, recycling them when returned.

[GoF95] provides a surrogate or placeholder for another object, to control access to it.

Proactive Resource Allocation [Cros02] anticipates system changes and plans necessary resource allocations ahead of time, with the goal of maintaining system performance even under changed conditions.

[POSA2] allows event-driven applications to demultiplex and dispatch service requests that are delivered to an application from one or more clients.

Reflection [POSA1] provides a mechanism for changing the structure and behavior of software systems dynamically. A meta level provides information about selected system properties and makes the software self-aware.

Resource Exchanger [SaCa96] reduces a server's load when allocating and using resources by sharing common buffers that are passed between clients and servers.

[GoF95] ensures a class has only one instance, and provides a global point of access to it.

Sponsor-Selector [Wall97] separates three fundamentally different responsibilities: recommending a resource, selecting among resources, and using a resource.
http://www.cs.uni.edu/~wallingf/patterns/sponsor-selector.html (has a example of diagnosis system)

State [GoF95] allows an object to alter its behavior when its internal state changes.

Strategy [GoF95] encapsulates logic, such as algorithms, into interchangeable classes that are independent of client requests.

Thread-local Memory Pool [Somm02] allows a memory allocator to be created for each thread. This helps to reduce synchronization overheads, since dynamic memory allocations are performed from a thread-local pool of pre-allocated memory.

Thread Pooling [PeSo97] describes how to bound the number of threads used and how to reuse unused threads.
Thread pooling works only when the tasks are relatively short-lived.For tasks that run indefinitely, a normal thread is usually
a better choice.

Variable Allocation [NoWe00] optimizes memory consumption by performing memory allocations on demand.How can you avoid unused empty space? Allocate and deallocate variable-sized objects as and when you need them.




1楼 学phper说: 2016-04-05 04:41:08
2楼 学phper说: 2016-04-05 04:41:08
3楼 -1'说: 2016-04-05 04:41:10
4楼 -1'说: 2016-05-10 03:07:37
5楼 学phper说: 2016-09-11 04:15:10
6楼 -1'说: 2016-09-11 04:15:11
7楼 Blue说: 2016-10-02 04:33:41
Ah, Lost Odyssey – the game that makes me regret not owning a 360. I played about halfway through it on a roma&mteo#8217;s console before I moved out, and I absolutely loved it. Combat flows well, the skill-linking mechanic is neat, and the text-based backstory sequences blew me away much more than I expected them to. I still want to finish it someday.