crystal-patterns

Version, currently master branch1 version
  • master branchlatestNov 20, 2025

github.com/crystal-community/crystal-patterns

:book: Examples of GOF patterns written in Crystal

308 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  crystal-patterns:
    github: crystal-community/crystal-patterns
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
0.24.2
License
MIT
Author
Vitalii Elenhaupt <velenhaupt@gmail.com>

Dependencies

Development Dependencies

  • ameba*github: crystal-ameba/amebadev

README

# Crystal Patterns

Design patterns implemented in Crystal language.

The goal is to have a set of [GOF patterns](http://www.blackwasp.co.uk/gofpatterns.aspx) for Crystal users.

## Available implementations

- Behavioral
  - [Command](behavioral/command.cr)
  - [Iterator](behavioral/iterator.cr)
  - [Memento](behavioral/memento.cr)
  - [Observer](behavioral/observer.cr)
  - [State](behavioral/state.cr)
  - [Strategy](behavioral/strategy.cr)
  - [Template](behavioral/template.cr)
  - [Visitor](behavioral/visitor.cr)
  - [Mediator](behavioral/mediator.cr)
  - [Chain of Responsibility](behavioral/chain_of_responsibility.cr)
  - [Interpreter](behavioral/interpreter.cr)
- Creational
  - [Abstract Factory](creational/abstract_factory.cr)
  - [Builder](creational/builder.cr)
  - [Factory Method](creational/factory_method.cr)
  - [Prototype](creational/prototype.cr)
  - [Singleton](creational/singleton.cr)
- Structural
  - [Adapter](structural/adapter.cr)
  - [Bridge](structural/bridge.cr)
  - [Composite](structural/composite.cr)
  - [Decorator](structural/decorator.cr)
  - [Facade](structural/facade.cr)
  - [Flyweight](structural/flyweight.cr)
  - [Proxy](structural/proxy.cr)

If you found any inconsistency or a place for improvement, pull requests are welcomed.

## Want more?

* [Crystal Design Patterns](https://github.com/bthachdev/crystal-design-patterns)
* [Design Patterns in Ruby](https://github.com/nslocum/design-patterns-in-ruby)

## Contributors

* [veelenga](https://github.com/veelenga) V. Elenhaupt - creator, maintainer
* [silverweed](https://github.com/silverweed) Silverweed - contributor
* [anicholson](https://github.com/anicholson) Andy Nicholson - contributor