• Stars
    star
    405
  • Rank 106,656 (Top 3 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Collections of Go patterns based on tmrts/go-patterns, But merged with other awesome forks and more improvoments.

gopher

Go Patterns
build-status awesome license

A curated collection of idiomatic design & application patterns for Go language.

a fork of tmrts/go-patterns but merged in with other awesome forks. can go with patterns-in-examples

Merged Repos

Creational Patterns

Pattern Description Status
Abstract Factory Provides an interface for creating families of releated objects โœ”
Builder Builds a complex object using simple objects โœ”
Factory Method Defers instantiation of an object to a specialized function for creating instances โœ”
Object Pool Instantiates and maintains a group of objects instances of the same type โœ”
Singleton Restricts instantiation of a type to one object โœ”

Structural Patterns

Pattern Description Status
Bridge Decouples an interface from its implementation so that the two can vary independently โœ”
Composite Encapsulates and provides access to a number of different objects โœ”
Decorator Adds behavior to an object, statically or dynamically โœ”
Facade Uses one type as an API to a number of others โœ”
Flyweight Reuses existing instances of objects with similar/identical state to minimize resource usage โœ”
Proxy Provides a surrogate for an object to control it's actions โœ”
Adapter Provides a surrogate for an object to control it's actions โœ”

Behavioral Patterns

Pattern Description Status
Chain of Responsibility Avoids coupling a sender to receiver by giving more than object a chance to handle the request โœ”
Command Bundles a command and arguments to call later โœ”
Mediator Connects objects and acts as a proxy โœ”
Memento Generate an opaque token that can be used to go back to a previous state โœ”
Observer Provide a callback for notification of events/changes to data โœ”
Registry Keep track of all subclasses of a given class โœ”
State Encapsulates varying behavior for the same object based on its internal state โœ”
Strategy Enables an algorithm's behavior to be selected at runtime โœ”
Template Defines a skeleton class which defers some methods to subclasses โœ”
Visitor Separates an algorithm from an object on which it operates โœ”
Interpreter interpret your own language or composed commands โœ”

Synchronization Patterns

Pattern Description Status
Condition Variable Provides a mechanism for threads to temporarily give up access in order to wait for some condition โœ˜
Lock/Mutex Enforces mutual exclusion limit on a resource to gain exclusive access โœ˜
Monitor Combination of mutex and condition variable patterns โœ˜
Read-Write Lock Allows parallel read access, but only exclusive access on write operations to a resource โœ”
Semaphore Allows controlling access to a common resource โœ”

Concurrency Patterns

Pattern Description Status
N-Barrier Prevents a process from proceeding until all N processes reach to the barrier โœ”
Bounded Parallelism Completes large number of independent tasks with resource limits โœ”
Broadcast Transfers a message to all recipients simultaneously โœ˜
Coroutines Subroutines that allow suspending and resuming execution at certain locations โœ˜
Generators Yields a sequence of values one at a time โœ”
Reactor Demultiplexes service requests delivered concurrently to a service handler and dispatches them synchronously to the associated request handlers โœ˜
Parallelism Completes large number of independent tasks โœ”
Producer Consumer Separates tasks from task executions โœ”

Messaging Patterns

Pattern Description Status
Fan-In Funnels tasks to a work sink (e.g. server) โœ”
Fan-Out Distributes tasks among workers (e.g. producer) โœ”
Futures & Promises Acts as a place-holder of a result that is initially unknown for synchronization purposes โœ”
Publish/Subscribe Passes information to a collection of recipients who subscribed to a topic โœ”
Push & Pull Distributes messages to multiple workers, arranged in a pipeline โœ˜

Stability Patterns

Pattern Description Status
Bulkheads Enforces a principle of failure containment (i.e. prevents cascading failures) โœ˜
Circuit-Breaker Stops the flow of the requests when requests are likely to fail โœ”
Deadline 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 Checks the availability of required resources at the start of a request and fails if the requirements are not satisfied โœ˜
Handshaking Asks a component if it can take any more load, if it can't, the request is declined โœ˜
Steady-State For every service that accumulates a resource, some other service must recycle that resource โœ˜

Profiling Patterns

Pattern Description Status
Timing Functions Wraps a function and logs the execution โœ”

Idioms

Pattern Description Status
Functional Options Allows creating clean APIs with sane defaults and idiomatic overrides โœ”

Anti-Patterns

Pattern Description Status

A pattern implementation

go-pattern-examples

More Repositories

1

go-pattern-examples

Examples of implement for awesome go patterns including usual design patterns, in easy understanding examples.
Go
108
star
2

go-fucking-exercise

go basic learning exercises for starting trip as a new beginner or reviewing courses
Go
22
star
3

bingai

BingAI Magic Service
HTML
3
star
4

pythontrip

coding in python way, python is a nice language
Python
2
star
5

sip_stack

eXosip2+ osip2 +sippaser2
C
1
star
6

CsharpCom

a Csharp souluton for cpp using ,simple C++ and C#
C#
1
star
7

batch-handle-git-repo

batch handle for git ,including add remote repoใ€pull reposใ€sync repos etc.
Shell
1
star
8

about

about crazybber
1
star
9

Node.JS-Learn-Sample

Some Node.js Demo Code Snip
JavaScript
1
star
10

Android-Service-Modules-Plugin

Android plugin Platform Framework Code
Java
1
star
11

application

1
star
12

python-starter

a Python learning Project
Python
1
star
13

node-online

a common node.js server to provide webapi with MogoDB/Express/Socket.IO
JavaScript
1
star
14

Caliburn.Micro.Learn

Caliburn.Micro Framework Sample
C#
1
star
15

go-jupyter

spark big data exploring in jupyterlab
Jupyter Notebook
1
star
16

ng-scully-md-template

a starter template for scully angular markdown content site
TypeScript
1
star
17

rustlings-starter

a rustlings classes starter with answers to help you to learn rust by example exercises
Rust
1
star
18

dynamic-introduce

introduce yourself, already updated to latest(vue2+webpack4+babel7) . Demo Here:
JavaScript
1
star
19

Logs-Collector

a LogsCollector
C#
1
star
20

LearnGit

when learning git you can use it.
Python
1
star
21

awesome-cangjie

ไป“้ข‰่ฏญ่จ€ไผ˜็ง€ๅผ€ๆบ้กน็›ฎ้›†Cangjie Open Source Projects Collections
1
star