1
0
mirror of https://github.com/tmrts/go-patterns.git synced 2024-11-21 20:46:08 +03:00

SUMMARY: index pattern sections

This commit is contained in:
Tamer Tas 2016-09-13 15:48:48 +03:00
parent f009bea3b0
commit 418cd23c0a
3 changed files with 135 additions and 52 deletions

104
README.md
View File

@ -15,105 +15,105 @@ A curated collection of idiomatic design & application patterns for Go language.
| Pattern | Description | Status | | Pattern | Description | Status |
|:-------:|:----------- |:------:| |:-------:|:----------- |:------:|
| [Abstract Factory](creational/abstract_factory.md) | Provides an interface for creating families of releated objects | ✘ | | [Abstract Factory](/creational/abstract_factory.md) | Provides an interface for creating families of releated objects | ✘ |
| [Builder](creational/builder.md) | Builds a complex object using simple objects | ✘ | | [Builder](/creational/builder.md) | Builds a complex object using simple objects | ✘ |
| [Factory Method](creational/factory.md) | Defers instantiation of an object to a specialized function for creating instances | ✘ | | [Factory Method](/creational/factory.md) | Defers instantiation of an object to a specialized function for creating instances | ✘ |
| [Object Pool](creational/object_pool.md) | Instantiates and maintains a group of objects instances of the same type | ✔ | | [Object Pool](/creational/object_pool.md) | Instantiates and maintains a group of objects instances of the same type | ✔ |
| [Singleton](creational/singleton.md) | Restricts instantiation of a type to one object | ✔ | | [Singleton](/creational/singleton.md) | Restricts instantiation of a type to one object | ✔ |
## Structural Patterns ## Structural Patterns
| Pattern | Description | Status | | Pattern | Description | Status |
|:-------:|:----------- |:------:| |:-------:|:----------- |:------:|
| [Adapter](structural/.md) | Adapts otherwise incompatible interfaces to work together by adapting one to the other | ✘ | | [Adapter](/structural/adapter.md) | Adapts otherwise incompatible interfaces to work together by adapting one to the other | ✘ |
| [Bridge](structural/bridge.md) | Decouples an interface from its implementation so that the two can vary independently | ✘ | | [Bridge](/structural/bridge.md) | Decouples an interface from its implementation so that the two can vary independently | ✘ |
| [Composite](structural/composite.md) | Encapsulates and provides access to a number of different objects | ✘ | | [Composite](/structural/composite.md) | Encapsulates and provides access to a number of different objects | ✘ |
| [Decorator](structural/decorator.md) | Adds behavior to an object, statically or dynamically | ✔ | | [Decorator](/structural/decorator.md) | Adds behavior to an object, statically or dynamically | ✔ |
| [Facade](structural/facade.md) | Uses one type as an API to a number of others | ✘ | | [Facade](/structural/facade.md) | Uses one type as an API to a number of others | ✘ |
| [Flyweight](structural/flyweight.md) | Reuses existing instances of objects with similar/identical state to minimize resource usage | ✘ | | [Flyweight](/structural/flyweight.md) | Reuses existing instances of objects with similar/identical state to minimize resource usage | ✘ |
| [Model View Controller](structural/model_view_controller.md) | Divides an app into three interconnected parts to separate internal representation from presentation to user | ✘ | | [Model View Controller](/structural/model_view_controller.md) | Divides an app into three interconnected parts to separate internal representation from presentation to user | ✘ |
| [Proxy](structural/proxy.md) | Provides a surrogate for an object to control it's actions | ✘ | | [Proxy](/structural/proxy.md) | Provides a surrogate for an object to control it's actions | ✘ |
## Behavioral Patterns ## Behavioral Patterns
| Pattern | Description | Status | | Pattern | Description | Status |
|:-------:|:----------- |:------:| |:-------:|:----------- |:------:|
| [Chain of Responsibility](behavioral/chain_of_responsibility.md) | Avoids coupling a sender to receiver by giving more than object a chance to handle the request | ✘ | | [Chain of Responsibility](/behavioral/chain_of_responsibility.md) | Avoids coupling a sender to receiver by giving more than object a chance to handle the request | ✘ |
| [Command](behavioral/command.md) | Bundles a command and arguments to call later | ✘ | | [Command](/behavioral/command.md) | Bundles a command and arguments to call later | ✘ |
| [Mediator](behavioral/mediator.md) | Connects objects and acts as a proxy | ✘ | | [Mediator](/behavioral/mediator.md) | Connects objects and acts as a proxy | ✘ |
| [Memento](behavioral/memento.md) | Generate an opaque token that can be used to go back to a previous state | ✘ | | [Memento](/behavioral/memento.md) | Generate an opaque token that can be used to go back to a previous state | ✘ |
| [Observer](behavioral/observer.md) | Provide a callback for notification of events/changes to data | ✔ | | [Observer](/behavioral/observer.md) | Provide a callback for notification of events/changes to data | ✔ |
| [Registry](behavioral/registry.md) | Keep track of all subclasses of a given class | ✘ | | [Registry](/behavioral/registry.md) | Keep track of all subclasses of a given class | ✘ |
| [State](behavioral/state.md) | Encapsulates varying behavior for the same object based on its internal state | ✘ | | [State](/behavioral/state.md) | Encapsulates varying behavior for the same object based on its internal state | ✘ |
| [Strategy](behavioral/strategy.md) | Enables an algorithm's behavior to be selected at runtime | ✔ | | [Strategy](/behavioral/strategy.md) | Enables an algorithm's behavior to be selected at runtime | ✔ |
| [Template](behavioral/template.md) | Defines a skeleton class which defers some methods to subclasses | ✘ | | [Template](/behavioral/template.md) | Defines a skeleton class which defers some methods to subclasses | ✘ |
| [Visitor](behavioral/visitor.md) | Separates an algorithm from an object on which it operates | ✘ | | [Visitor](/behavioral/visitor.md) | Separates an algorithm from an object on which it operates | ✘ |
## Synchronization Patterns ## Synchronization Patterns
| Pattern | Description | Status | | Pattern | Description | Status |
|:-------:|:----------- |:------:| |:-------:|:----------- |:------:|
| [Condition Variable](synchronization/condition_variable.md) | Provides a mechanism for threads to temporarily give up access in order to wait for some condition | ✘ | | [Condition Variable](/synchronization/condition_variable.md) | Provides a mechanism for threads to temporarily give up access in order to wait for some condition | ✘ |
| [Lock/Mutex](synchronization/mutex.md) | Enforces mutual exclusion limit on a resource to gain exclusive access | ✘ | | [Lock/Mutex](/synchronization/mutex.md) | Enforces mutual exclusion limit on a resource to gain exclusive access | ✘ |
| [Monitor](synchronization/monitor.md) | Combination of mutex and condition variable patterns | ✘ | | [Monitor](/synchronization/monitor.md) | Combination of mutex and condition variable patterns | ✘ |
| [Read-Write Lock](synchronization/read_write_lock.md) | Allows parallel read access, but only exclusive access on write operations to a resource | ✘ | | [Read-Write Lock](/synchronization/read_write_lock.md) | Allows parallel read access, but only exclusive access on write operations to a resource | ✘ |
| [Semaphore](synchronization/semaphore.md) | Allows controlling access to a common resource | ✔ | | [Semaphore](/synchronization/semaphore.md) | Allows controlling access to a common resource | ✔ |
## Concurrency Patterns ## Concurrency Patterns
| Pattern | Description | Status | | Pattern | Description | Status |
|:-------:|:----------- |:------:| |:-------:|:----------- |:------:|
| [N-Barrier](concurrency/barrier.md) | Prevents a process from proceeding until all N processes reach to the barrier | ✘ | | [N-Barrier](/concurrency/barrier.md) | Prevents a process from proceeding until all N processes reach to the barrier | ✘ |
| [Bounded Parallelism](concurrency/bounded_parallelism.md) | Completes large number of independent tasks with resource limits | ✔ | | [Bounded Parallelism](/concurrency/bounded_parallelism.md) | Completes large number of independent tasks with resource limits | ✔ |
| [Broadcast](concurrency/broadcast.md) | Transfers a message to all recipients simultaneously | ✘ | | [Broadcast](/concurrency/broadcast.md) | Transfers a message to all recipients simultaneously | ✘ |
| [Coroutines](concurrency/coroutine.md) | Subroutines that allow suspending and resuming execution at certain locations | ✘ | | [Coroutines](/concurrency/coroutine.md) | Subroutines that allow suspending and resuming execution at certain locations | ✘ |
| [Generators](concurrency/generator.md) | Yields a sequence of values one at a time | ✘ | | [Generators](/concurrency/generator.md) | Yields a sequence of values one at a time | ✘ |
| [Reactor](concurrency/reactor.md) | Demultiplexes service requests delivered concurrently to a service handler and dispatches them syncronously to the associated request handlers | ✘ | | [Reactor](/concurrency/reactor.md) | Demultiplexes service requests delivered concurrently to a service handler and dispatches them syncronously to the associated request handlers | ✘ |
| [Parallelism](concurrency/parallelism.md) | Completes large number of independent tasks | ✔ | | [Parallelism](/concurrency/parallelism.md) | Completes large number of independent tasks | ✔ |
| [Producer Consumer](concurrency/producer_consumer.md) | Separates tasks from task executions | ✘ | | [Producer Consumer](/concurrency/producer_consumer.md) | Separates tasks from task executions | ✘ |
| [Scheduler](concurrency/scheduler.md) | Orchestrates steps to be performed as part of a task | ✘ | | [Scheduler](/concurrency/scheduler.md) | Orchestrates steps to be performed as part of a task | ✘ |
## Messaging Patterns ## Messaging Patterns
| Pattern | Description | Status | | Pattern | Description | Status |
|:-------:|:----------- |:------:| |:-------:|:----------- |:------:|
| [Fan-In](messaging/fan_in.md) | Funnels tasks to a work sink (e.g. server) | ✔ | | [Fan-In](/messaging/fan_in.md) | Funnels tasks to a work sink (e.g. server) | ✔ |
| [Fan-Out](messaging/fan_out.md) | Distributes tasks among workers (e.g. producer) | ✔ | | [Fan-Out](/messaging/fan_out.md) | Distributes tasks among workers (e.g. producer) | ✔ |
| [Futures & Promises](messaging/futures_promises.md) | Acts as a place-holder of a result that is initially unknown for synchronization purposes | ✘ | | [Futures & Promises](/messaging/futures_promises.md) | Acts as a place-holder of a result that is initially unknown for synchronization purposes | ✘ |
| [Publish/Subscribe](messaging/publish_subscribe.md) | Passes information to a collection of recipients who subscribed to a topic | ✔ | | [Publish/Subscribe](/messaging/publish_subscribe.md) | Passes information to a collection of recipients who subscribed to a topic | ✔ |
| [Push & Pull](messaging/push_pull.md) | Distributes messages to multiple workers, arranged in a pipeline | ✘ | | [Push & Pull](/messaging/push_pull.md) | Distributes messages to multiple workers, arranged in a pipeline | ✘ |
## Stability Patterns ## Stability Patterns
| Pattern | Description | Status | | Pattern | Description | Status |
|:-------:|:----------- |:------:| |:-------:|:----------- |:------:|
| [Bulkheads](stability/bulkhead.md) | Enforces a principle of failure containment (i.e. prevents cascading failures) | ✘ | | [Bulkheads](/stability/bulkhead.md) | Enforces a principle of failure containment (i.e. prevents cascading failures) | ✘ |
| [Circuit-Breaker](stability/circuit_breaker.md) | Stops the flow of the requests when requests are likely to fail | ✔ | | [Circuit-Breaker](/stability/circuit_breaker.md) | Stops the flow of the requests when requests are likely to fail | ✔ |
| [Deadline](stability/deadline.md) | 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) | ✘ | | [Deadline](/stability/deadline.md) | 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) | ✘ |
| [Fail-Fast](stability/fail_fast.md) | Checks the availability of required resources at the start of a request and fails if the requirements are not satisfied | ✘ | | [Fail-Fast](/stability/fail_fast.md) | Checks the availability of required resources at the start of a request and fails if the requirements are not satisfied | ✘ |
| [Handshaking](stability/handshaking.md) | Asks a component if it can take any more load, if it can't the request is declined | ✘ | | [Handshaking](/stability/handshaking.md) | Asks a component if it can take any more load, if it can't the request is declined | ✘ |
| [Steady-State](stability/steady_state.md) | For every service that accumulates a resource, some other service must recycle that resource | ✘ | | [Steady-State](/stability/steady_state.md) | For every service that accumulates a resource, some other service must recycle that resource | ✘ |
## Profiling Patterns ## Profiling Patterns
| Pattern | Description | Status | | Pattern | Description | Status |
|:-------:|:----------- |:------:| |:-------:|:----------- |:------:|
| [Timing Functions](profiling/timing.md) | Wraps a function and logs the execution | ✘ | | [Timing Functions](/profiling/timing.md) | Wraps a function and logs the execution | ✘ |
## Idioms ## Idioms
| Pattern | Description | Status | | Pattern | Description | Status |
|:-------:|:----------- |:------:| |:-------:|:----------- |:------:|
| [Functional Options](idiom/functional-options.md) | Allows creating clean APIs with sane defaults and idiomatic overrides | ✔ | | [Functional Options](/idiom/functional-options.md) | Allows creating clean APIs with sane defaults and idiomatic overrides | ✔ |
## Anti-Patterns ## Anti-Patterns
| Pattern | Description | Status | | Pattern | Description | Status |
|:-------:|:----------- |:------:| |:-------:|:----------- |:------:|
| [Cascading Failures](antipatterns/cascading_failures.md) | A failure in a system of interconnected parts in which the failure of a part causes a domino effect | ✘ | | [Cascading Failures](/anti-patterns/cascading_failures.md) | A failure in a system of interconnected parts in which the failure of a part causes a domino effect | ✘ |
## Other Patterns ## Other Patterns
| Pattern | Description | Status | | Pattern | Description | Status |
|:-------:|:----------- |:------:| |:-------:|:----------- |:------:|
| | | | | | | | |

66
SUMMARY.md Normal file
View File

@ -0,0 +1,66 @@
# Summary
* [Go Patterns](/README.md)
* [Creational Patterns](/README.md#creational-patterns)
* [Abstract Factory](/creational/abstract_factory.md)
* [Builder](/creational/builder.md)
* [Factory Method](/creational/factory.md)
* [Object Pool](/creational/object_pool.md)
* [Singleton](/creational/singleton.md)
* [Structural Patterns](/README.md#structural-patterns)
* [Adapter](/structural/adapter.md)
* [Bridge](/structural/bridge.md)
* [Composite](/structural/composite.md)
* [Decorator](/structural/decorator.md)
* [Facade](/structural/facade.md)
* [Flyweight](/structural/flyweight.md)
* [Model View Controller](/structural/model_view_controller.md)
* [Proxy](/structural/proxy.md)
* [Behavioral Patterns](/README.md#behavioral-patterns)
* [Chain of Responsibility](/behavioral/chain_of_responsibility.md)
* [Command](/behavioral/command.md)
* [Mediator](/behavioral/mediator.md)
* [Memento](/behavioral/memento.md)
* [Observer](/behavioral/observer.md)
* [Registry](/behavioral/registry.md)
* [State](/behavioral/state.md)
* [Strategy](/behavioral/strategy.md)
* [Template](/behavioral/template.md)
* [Visitor](/behavioral/visitor.md)
* [Synchronization Patterns](/README.md#synchronization-patterns)
* [Condition Variable](/synchronization/condition_variable.md)
* [Lock/Mutex](/synchronization/mutex.md)
* [Monitor](/synchronization/monitor.md)
* [Read-Write Lock](/synchronization/read_write_lock.md)
* [Semaphore](/synchronization/semaphore.md)
* [Concurrency Patterns](/README.md#concurrency-patterns)
* [N-Barrier](/concurrency/barrier.md)
* [Bounded Parallelism](/concurrency/bounded_parallelism.md)
* [Broadcast](/concurrency/broadcast.md)
* [Coroutines](/concurrency/coroutine.md)
* [Generators](/concurrency/generator.md)
* [Reactor](/concurrency/reactor.md)
* [Parallelism](/concurrency/parallelism.md)
* [Producer Consumer](/concurrency/producer_consumer.md)
* [Scheduler](/concurrency/scheduler.md)
* [Messaging Patterns](/README.md#messaging-patterns)
* [Fan-In](/messaging/fan_in.md)
* [Fan-Out](/messaging/fan_out.md)
* [Futures & Promises](/messaging/futures_promises.md)
* [Publish/Subscribe](/messaging/publish_subscribe.md)
* [Push & Pull](/messaging/push_pull.md)
* [Stability Patterns](/README.md#stability-patterns)
* [Bulkheads](/stability/bulkhead.md)
* [Circuit-Breaker](/stability/circuit_breaker.md)
* [Deadline](/stability/deadline.md)
* [Fail-Fast](/stability/fail_fast.md)
* [Handshaking](/stability/handshaking.md)
* [Steady-State](/stability/steady_state.md)
* [Profiling Patterns](/README.md#profiling-patterns)
* [Timing Functions](/profiling/timing.md)
* [Idioms](/README.md#idioms)
* [Functional Options](/idiom/functional-options.md)
* [Anti-Patterns](/README.md#anti-patterns)
* [Cascading Failures](/anti-patterns/cascading_failures.md)
* [Other Patterns](/README.md#other-patterns)
* [Contributing](/CONTRIBUTING.md)

17
book.json Normal file
View File

@ -0,0 +1,17 @@
{
"plugins": [
"-search",
"-lunr",
"github",
"edit-link"
],
"pluginsConfig": {
"github": {
"url": "https://github.com/tmrts/go-patterns"
},
"edit-link": {
"base": "https://github.com/tmrts/go-patterns/edit/master/",
"label": ""
}
}
}