Home

Awesome

Design Patterns in Rust

Note: This used to be a repository for design patterns in Python, it is in the process of being converted over into Rust.

Implementation of various design patterns in a new and exciting language called Rust.

These are supposed to be simple examples to not only illustrate the design pattern, but to make it easier to remember.

Using

To learn about a given pattern, open up the source code. All of the patterns are defined in the patterns directory.

To run a given pattern, just run it like this:


# Be in the repository
$ cd design-patterns/

# Run the Adapter pattern
$ make adapter

Be sure to take a look at the list of patterns.

Also included is the complete list of Design Principles listed in the book, Head First Design Patterns, from order of introduction. It is a great resource that reminds one on some very important principles when it comes to software design.

Learning

All of the patterns can be found in the patterns directory.

To learn about a given pattern, just navigate to the [documentation][docs] page for the design patterns.

Each design pattern will have:

  1. A definition
  2. List of alternative names (if the pattern has any)
  3. A common problem the pattern solves
  4. A wrong solution
  5. A correct solution using the pattern
  6. Sources used for the pattern for continued reading

List of Patterns

Sources

  1. Title: Head First Design Patterns

    Author(s): Eric Freeman & Elisabeth Freeman

    Link(s): Site, Amazon

  2. Title: Design Patterns: Elements of Reusable Object-Oriented Software

    Author(s): Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides

    Link(s): Wikipedia, Amazon