Putting a friendly face on statelessness, the Stateless Designer Visual Studio Extension
- Posted: Mar 03, 2014 at 6:00 AM
- 12,024 Views
It's Monday and it's time for another Visual Studio Extension! Are you excited? (Come on... you know you are... okay, be nice now... lol...) Today we're highlighting an extension that's just a little different and something you might think you don't need, but maybe after you take a closer look you'll be rethinking that...
Morten Frederiksen and, by extension, Nicholas Blumhardt are bringing us today's extension...
Visual Studio extension to support visual design of stateless state machines. Support for Visual Studio 2012 and Visual Studio 2013.
stateless is a lightweight C# hierarchical state machine framework made by Nicholas Blumhardt. The stateless project is hosted here: http://code.google.com/p/stateless/. If you don't know stateless, here is a comparison between stateless and Windows Workflow Foundation: Comparison between Stateless (on google code) and Windows Workflow. stateless also comes as a NuGet package: http://nuget.org/packages/Stateless. stateless is a great alternative to WWF.
About Stateless Designer
The goal for this projects is to allow software developers to design a state machines visually. Why a statemachine can improve your design. The true power of using a state machine is to have a graph showing the states with transitions. Stateless Designer can help you achieve this.
Stateless Developer use case:
- install Stateless Designer
- start Visual Studio
- create or open a C# project
- Add new Item to the C# project
- select Stateless State Machine
- design your state machine
- a C# class is created with your state machine
Currently supported features- Triggers without arguments
- OnEntry and OnExit delegates
- Reentrant transitions
- OnUnhandledTrigger delegate - new in Stateless Designer 1.4
- Guard Clauses: PermitIf and PermitReentryIf functionality - new in Stateless Designer 1.4
- Visual Studio Extensibility
Got any improvement ideas?
Getting started with this designer is easy, but still you should walk through the provided guide.
Using Stateless Designer by example
This examples shows how to use Stateless Designer in a WPF application to crate a state machine that controls the UI flow.
Install Stateless Designer
And the great part is that the source for both the Designer by Morten Frederiksen and stateless library by Nicholas Blumhardt is available...
What is stateless? Funny you should ask...
Create state machines and lightweight state machine-based workflows directly in .NET code:
This project, as well as the example above, was inspired by Simple State Machine.
Most standard state machine constructs are supported:
- Generic support for states and triggers of any .NET type (numbers, strings, enums, etc.)
- Hierarchical states
- Entry/exit events for states
- Guard clauses to support conditional transitions
Some useful extensions are also provided:
- Ability to store state externally (for example, in a property tracked by Linq to SQL)
- Parameterised triggers
- Reentrant states
External State Storage
Ignored Transitions and Reentrant States
Stateless is a base for exploration of generic and functional programming to drive workflow in .NET.
This page is an almost-complete description of Stateless, and its explicit aim is to remain minimal.
Please use the issue tracker or the if you'd like to report problems or discuss features. Suggestions can also be made at the Stateless UserVoice forum.
You're now ready to get started designing your stateless state...