1
0
mirror of https://github.com/tmrts/go-patterns.git synced 2024-11-25 22:46:05 +03:00

Update README

This commit is contained in:
Tamer Tas 2016-01-19 08:49:13 +02:00
parent 258ef4958d
commit 25c473d8e0

View File

@ -5,23 +5,24 @@
# Go Patterns [![Travis Widget]][Travis] [![Awesome Widget]][Awesome] [![License Widget]][License] # Go Patterns [![Travis Widget]][Travis] [![Awesome Widget]][Awesome] [![License Widget]][License]
[Awesome Widget]: https://img.shields.io/badge/awesome-%E2%9C%93-ff69b4.svg?style=flat-square [Awesome Widget]: https://img.shields.io/badge/awesome-%E2%9C%93-ff69b4.svg?style=flat-square
[Awesome]: https://github.com/sindresorhus/awesome [Awesome]: https://github.com/sindresorhus/awesome
[Travis Widget]: https://img.shields.io/travis/tmrts/awesome-google-cloud.svg?style=flat-square [Travis Widget]: https://img.shields.io/travis/tmrts/go-patterns.svg?style=flat-square
[Travis]: http://travis-ci.org/tmrts/go-patterns [Travis]: http://travis-ci.org/tmrts/go-patterns
[License Widget]: https://img.shields.io/badge/license-Creative%20Commons%204.0-E91E63.svg?style=flat-square [License Widget]: https://img.shields.io/badge/license-Creative%20Commons%204.0-E91E63.svg?style=flat-square
[License]: http://creativecommons.org/licenses/by/4.0/ [License]: http://creativecommons.org/licenses/by/4.0/
A curated collection of idiomatic design & application patterns for Go language. A curated collection of idiomatic design & application patterns for Go language.
For use cases please see the test files (files suffixed with _test).
__Creational Patterns__: __Creational Patterns__:
| Pattern | Description | | Pattern | Description |
|:-------:| ----------- | |:-------:| ----------- |
| [Abstract Factory](abstract_factory.go) | use a generic function with specific factories | | [Abstract Factory](abstract_factory.go) | use a generic function with specific factories |
| [Borg Singleton](borg_singleton.go) | a singleton with shared-state among instances | | [Singleton](singleton/singleton.go) | Restricts instantiation of a class to one object |
| [Builder](builder.go) | instead of using multiple constructors, builder object receives parameters and returns constructed objects | | [Builder](builder/builder.go) | instead of using multiple constructors, builder object receives parameters and returns constructed objects |
| [Factory Method](factory_method.go) | delegate a specialized function/method to create instances | | [Factory Method](factory_method.go) | delegate a specialized function/method to create instances |
| [Lazy Evaluation](lazy_evaluation.go) | lazily-evaluated property pattern in Go | | [Lazy Evaluation](lazy_evaluation.go) | lazily-evaluated property pattern in Go |
| [Object Pool](object_pool.go) | preinstantiate and maintain a group of instances of the same type | | [Object Pool](object_pool/pool.go) | Instantiates and maintains a group of objects instances of the same type |
| [Prototype](prototype.go) | use a factory and clones of a prototype for new instances (if instantiation is expensive) |
__Structural Patterns__: __Structural Patterns__:
@ -47,11 +48,10 @@ __Behavioral Patterns__:
| [Mediator](mediator.go) | an object that knows how to connect other objects and act as a proxy | | [Mediator](mediator.go) | an object that knows how to connect other objects and act as a proxy |
| [Memento](memento.go) | generate an opaque token that can be used to go back to a previous state | | [Memento](memento.go) | generate an opaque token that can be used to go back to a previous state |
| [Observer](observer.go) | provide a callback for notification of events/changes to data | | [Observer](observer.go) | provide a callback for notification of events/changes to data |
| [Publish/Subscribe](publish_subscribe.go) | Passes information to a collection of recipients who subscribed to a topic |
| [Registry](registry.go) | keep track of all subclasses of a given class | | [Registry](registry.go) | keep track of all subclasses of a given class |
| [Specification](specification.go) | business rules can be recombined by chaining the business rules together using boolean logic | | [Specification](specification.go) | business rules can be recombined by chaining the business rules together using boolean logic |
| [State](state.go) | logic is organized into a discrete number of potential states and the next state that can be transitioned to | | [State](state.go) | logic is organized into a discrete number of potential states and the next state that can be transitioned to |
| [Strategy](strategy.go) | Encapsulates an algorithm inside a struct | | [Strategy](strategy/strategy.go) | Encapsulates an algorithm inside a struct |
| [Template](template.go) | an object imposes a structure but takes pluggable components | | [Template](template.go) | an object imposes a structure but takes pluggable components |
| [Visitor](visitor.go) | invoke a callback for all items of a collection | | [Visitor](visitor.go) | invoke a callback for all items of a collection |
@ -59,11 +59,11 @@ __Synchronization Patterns__:
| Pattern | Description | | Pattern | Description |
|:-------:| ----------- | |:-------:| ----------- |
| [Lock/Mutex](mutex.go) | Enforces mutual exclusion limit on accessing a resource | | [Lock/Mutex](mutex/mutex.go) | Enforces mutual exclusion limit on accessing a resource |
| [Read-Write Lock](read_write_lock.go) | | | [Read-Write Lock](read_write_lock.go) | |
| [Condition Variable](condition_variable.go) | | | [Condition Variable](condition_variable.go) | |
| [Monitor](monitor.go) | Combination of mutex and condition patterns | | [Monitor](monitor.go) | Combination of mutex and condition variable patterns |
| [Semaphore](semaphore.go) | Allows controlling access to a common resource | | [Semaphore](semaphore/semaphore.go) | Allows controlling access to a common resource |
__Concurrency Patterns__: __Concurrency Patterns__:
@ -75,16 +75,25 @@ __Concurrency Patterns__:
| [Futures](future.go) | | | [Futures](future.go) | |
| [Broadcast](broadcast.go) | | | [Broadcast](broadcast.go) | |
| [Multiplex](multiplex.go) | | | [Multiplex](multiplex.go) | |
| [Fan-In](fan_in.go) | |
| [Generators](generator.go) | | | [Generators](generator.go) | |
| [Coroutines](coroutine.go) | | | [Coroutines](coroutine/coroutine.go) | |
| [Parallelism](parallelism/md5.go) | Completes large number of indenpendent tasks |
| [Bounded Parallelism](bounded_parallelism/md5.go) | Completes large number of indenpendent tasks with resource limits |
__Messaging Patterns__:
| [Fan-In](fan/fan_in.go) | Funnels tasks to a work sink (e.g. server) |
| [Fan-Out](fan/fan_out.go) | Distributes tasks amongs workers |
| [Publish/Subscribe](publish_subscribe.go) | Passes information to a collection of recipients who subscribed to a topic |
| [Request & Reply](fan) | |
| [Push & Pull](fan) | |
__Stability Patterns__: __Stability Patterns__:
| Pattern | Description | | Pattern | Description |
|:-------:| ----------- | |:-------:| ----------- |
| [Bulkheads](bulkhead.go) | | | [Bulkheads](bulkhead.go) | |
| [Circuit Breaker](circuit_breaker.go) | | | [Circuit Breaker](circuitbreaker/circuit_breaker.go) | Stops the flow of the requests when requests are likely to fail |
| [Deadline](deadline.go) | | | [Deadline](deadline.go) | |
| [Fail Fast](fail_fast.go) | | | [Fail Fast](fail_fast.go) | |
| [Handshaking](handshaking.go) | | | [Handshaking](handshaking.go) | |
@ -106,6 +115,7 @@ __Anti-Patterns__:
| Pattern | Description | | Pattern | Description |
|:-------:| ----------- | |:-------:| ----------- |
| [Cascading Failures]() | |
__Other Patterns__: __Other Patterns__: