Code Monkey home page Code Monkey logo

statepattern's Introduction

State Design Pattern

An example of the State design pattern in C#.

New Mermaid syntax:

stateDiagram-v2
  [*] --> Unwritten
  
  Unwritten --> Open: Open
  Unwritten --> Void: Void
  
  Open --> Void: Void
  Open --> Cancelled: Cancel
  Open --> Closed: Close
  Open --> Open: Update
  
  Closed --> Open: Open
Loading

State Transition Diagram (copy here):

digraph PolicyState {
  size="8,5"
  node [shape = doublecircle]; Unwritten;
  node [shape = rectangle style=filled]; Void Cancelled;
  node [shape = circle];
  Unwritten -> Open [ label = "Open" ];
  Unwritten -> Void[ label = "Void" ];
  Open -> Cancelled [ label = "Cancel" ];
  Open -> Closed [label = "Close" ];
  Open -> Open [label = "Update"];
  Open -> Void [label = "Void"];
  Closed -> Open [label = "Open"];
  Void [color="0.000 1.000 1.000"];
  Cancelled [color="0.201 0.753 1.000"];
}

image

Notes

The State pattern is described in the Core project and tested in the unit tests. The web project doesn't yet do anything useful. Pull requests welcome to help visualize the pattern.

Added a GitHub Action that eventually will build and run tests.

statepattern's People

Contributors

ardalis avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.