Skip to content

Commit dc9da4a

Browse files
committed
Include a summary for each pattern
1 parent 25c473d commit dc9da4a

File tree

1 file changed

+44
-48
lines changed

1 file changed

+44
-48
lines changed

README.md

+44-48
Original file line numberDiff line numberDiff line change
@@ -11,93 +11,89 @@
1111
[License]: http://creativecommons.org/licenses/by/4.0/
1212
A curated collection of idiomatic design & application patterns for Go language.
1313

14-
For use cases please see the test files (files suffixed with _test).
15-
1614
__Creational Patterns__:
1715

1816
| Pattern | Description |
1917
|:-------:| ----------- |
20-
| [Abstract Factory](abstract_factory.go) | use a generic function with specific factories |
21-
| [Singleton](singleton/singleton.go) | Restricts instantiation of a class to one object |
22-
| [Builder](builder/builder.go) | instead of using multiple constructors, builder object receives parameters and returns constructed objects |
23-
| [Factory Method](factory_method.go) | delegate a specialized function/method to create instances |
24-
| [Lazy Evaluation](lazy_evaluation.go) | lazily-evaluated property pattern in Go |
18+
| [Abstract Factory](abstract_factory.go) | Provides an interface for creating families of releated objects |
19+
| [Builder](builder/builder.go) | Builds a complex object using simple objects |
20+
| [Factory Method](factory_method.go) | Defers instantiation of an object to a specialized function for creating instances |
2521
| [Object Pool](object_pool/pool.go) | Instantiates and maintains a group of objects instances of the same type |
22+
| [Singleton](singleton/singleton.go) | Restricts instantiation of a class to one object |
2623

2724
__Structural Patterns__:
2825

2926
| Pattern | Description |
3027
|:-------:| ----------- |
31-
| [Adapter](adapter.go) | adapt one interface to another using a white-list |
32-
| [Bridge](bridge.go) | a client-provider middleman to soften interface changes |
33-
| [Composite](composite.go) | encapsulate and provide access to a number of different objects |
28+
| [Adapter](adapter.go) | Adapts otherwise incompatible interfaces to work together by adapting one to the other |
29+
| [Bridge](bridge.go) | Decouples an interface from its implementation so that the two can vary independently |
30+
| [Composite](composite.go) | Encapsulates and provides access to a number of different objects |
3431
| [Decorator](decorator.go) | Adds behavior to an object, statically or dynamically |
35-
| [Facade](facade.go) | use one class as an API to a number of others |
36-
| [Flyweight](flyweight.go) | transparently reuse existing instances of objects with similar/identical state |
37-
| [Model View Controller](mvc.go) | model<->view<->controller (non-strict relationships) |
38-
| [Proxy](proxy.go) | an object funnels operations to something else |
32+
| [Facade](facade.go) | Uses one class as an API to a number of others |
33+
| [Flyweight](flyweight.go) | Reuses existing instances of objects with similar/identical state to minimize resource usage |
34+
| [Model View Controller](mvc.go) | Divides an app into three interconnected parts to separate internal representation from presentation to user |
35+
| [Proxy](proxy.go) | Provides a surrogate for an object to control it's actions |
3936

4037
__Behavioral Patterns__:
4138

4239
| Pattern | Description |
4340
|:-------:| ----------- |
44-
| [Chain](chain.go) | apply a chain of successive handlers to try and process the data |
45-
| [Catalog](catalog.go) | general methods will call different specialized methods based on construction parameter |
46-
| [Chaining Method](chaining_method.go) | continue callback next object method |
47-
| [Command](command.go) | bundle a command and arguments to call later |
48-
| [Mediator](mediator.go) | an object that knows how to connect other objects and act as a proxy |
49-
| [Memento](memento.go) | generate an opaque token that can be used to go back to a previous state |
50-
| [Observer](observer.go) | provide a callback for notification of events/changes to data |
51-
| [Registry](registry.go) | keep track of all subclasses of a given class |
52-
| [Specification](specification.go) | business rules can be recombined by chaining the business rules together using boolean logic |
53-
| [State](state.go) | logic is organized into a discrete number of potential states and the next state that can be transitioned to |
54-
| [Strategy](strategy/strategy.go) | Encapsulates an algorithm inside a struct |
55-
| [Template](template.go) | an object imposes a structure but takes pluggable components |
56-
| [Visitor](visitor.go) | invoke a callback for all items of a collection |
41+
| [Chain of Responsibility](chain_of_responsibility.go) | Avoids coupling a sender to receiver by giving more than object a chance to handle the request |
42+
| [Command](command.go) | Bundles a command and arguments to call later |
43+
| [Mediator](mediator.go) | Connects objects and acts as a proxy |
44+
| [Memento](memento.go) | Generate an opaque token that can be used to go back to a previous state |
45+
| [Observer](observer.go) | Provide a callback for notification of events/changes to data |
46+
| [Registry](registry.go) | Keep track of all subclasses of a given class |
47+
| [State](state.go) | Encapsulates varying behavior for the same object based on its internal state |
48+
| [Strategy](strategy/strategy.go) | Enables an algorithm's behavior to be selected at runtime |
49+
| [Template](template.go) | Defines a skeleton class which defers some methods to subclasses |
50+
| [Visitor](visitor.go) | Separates an algorithm from an object on which it operates |
5751

5852
__Synchronization Patterns__:
5953

6054
| Pattern | Description |
6155
|:-------:| ----------- |
62-
| [Lock/Mutex](mutex/mutex.go) | Enforces mutual exclusion limit on accessing a resource |
63-
| [Read-Write Lock](read_write_lock.go) | |
64-
| [Condition Variable](condition_variable.go) | |
56+
| [Condition Variable](condition_variable.go) | Provides a mechanism for threads to temporarily give up access in order to wait for some condition |
57+
| [Lock/Mutex](mutex/mutex.go) | Enforces mutual exclusion limit on a resource to gain exclusive access |
6558
| [Monitor](monitor.go) | Combination of mutex and condition variable patterns |
59+
| [Read-Write Lock](read_write_lock.go) | Allows parallel read access, but only exclusive access on write operations to a resource |
6660
| [Semaphore](semaphore/semaphore.go) | Allows controlling access to a common resource |
6761

6862
__Concurrency Patterns__:
6963

7064
| Pattern | Description |
7165
|:-------:| ----------- |
72-
| [Scheduler](scheduler.go) | |
73-
| [Barrier](barrier.go) | |
74-
| [Producer Consumer](producer_consumer.go) | |
75-
| [Futures](future.go) | |
76-
| [Broadcast](broadcast.go) | |
77-
| [Multiplex](multiplex.go) | |
78-
| [Generators](generator.go) | |
79-
| [Coroutines](coroutine/coroutine.go) | |
80-
| [Parallelism](parallelism/md5.go) | Completes large number of indenpendent tasks |
66+
| [N-Barrier](barrier.go) | Prevents a process from proceeding until all N processes reach to the barrier |
8167
| [Bounded Parallelism](bounded_parallelism/md5.go) | Completes large number of indenpendent tasks with resource limits |
68+
| [Broadcast](broadcast.go) | Transfers a message to all recipients simultaneously |
69+
| [Coroutines](coroutine/coroutine.go) | Subroutines that allow suspending and resuming execution at certain locations |
70+
| [Generators](generator.go) | Yields a sequence of values one at a time |
71+
| [Reactor](reactor.go) | Demultiplexes service requests delivered concurrently to a service handler and dispatches them syncronously to the associated request handlers |
72+
| [Parallelism](parallelism/md5.go) | Completes large number of indenpendent tasks |
73+
| [Producer Consumer](producer_consumer.go) | Separates tasks from task executions |
74+
| [Scheduler](scheduler.go) | Orchestrates steps to be performed as part of a task |
8275

8376
__Messaging Patterns__:
77+
78+
| Pattern | Description |
79+
|:-------:| ----------- |
8480
| [Fan-In](fan/fan_in.go) | Funnels tasks to a work sink (e.g. server) |
8581
| [Fan-Out](fan/fan_out.go) | Distributes tasks amongs workers |
82+
| [Futures & Promises](futures_promises.go) | Acts as a place-holder of a result that is initally unknown for synchronization purposes |
8683
| [Publish/Subscribe](publish_subscribe.go) | Passes information to a collection of recipients who subscribed to a topic |
87-
| [Request & Reply](fan) | |
88-
| [Push & Pull](fan) | |
84+
| [Push & Pull](push_pull.go) | Distributes messages to multiple workers, arranged in a pipeline |
8985

9086

9187
__Stability Patterns__:
9288

9389
| Pattern | Description |
9490
|:-------:| ----------- |
95-
| [Bulkheads](bulkhead.go) | |
96-
| [Circuit Breaker](circuitbreaker/circuit_breaker.go) | Stops the flow of the requests when requests are likely to fail |
97-
| [Deadline](deadline.go) | |
98-
| [Fail Fast](fail_fast.go) | |
99-
| [Handshaking](handshaking.go) | |
100-
| [Steady State](steady_state.go) | |
91+
| [Bulkheads](bulkhead.go) | Enforces a principle of failure containment (i.e. prevents cascading failures) |
92+
| [Circuit-Breaker](circuitbreaker/circuit_breaker.go) | Stops the flow of the requests when requests are likely to fail |
93+
| [Deadline](deadline.go) | Allows clients to stop waiting for a response once the probability of response becomes low (e.g. after waiting 10 seconds for a page refresh)|
94+
| [Fail-Fast](fail_fast.go) | Checks the availability of required resources at the start of a request and fails if the requirements are not satisfied |
95+
| [Handshaking](handshaking.go) | Asks a component if it can take any more load, if it can't the request is declined |
96+
| [Steady-State](steady_state.go) | For every service that accumulates a resource, some other service must recycle that resource |
10197

10298
__Profiling Patterns__:
10399

@@ -115,7 +111,7 @@ __Anti-Patterns__:
115111

116112
| Pattern | Description |
117113
|:-------:| ----------- |
118-
| [Cascading Failures]() | |
114+
| [Cascading Failures]() | A failure in a system of interconnected parts in which the failure of a part causes a domino effect |
119115

120116
__Other Patterns__:
121117

0 commit comments

Comments
 (0)