Noting slight differences


#1

Playing with the tool! Really enjoying it so far.

One thing I’ve encountered a couple times is that often I need to transition to a state but with a negligible difference. An example would be to go back to a previous state with an error message. In a formal sense this is a separate state, but when all the available actions are the same it can really clutter the spec and the diagram unnecessarily. So far my approach has been to add a comment, but this feels a bit buried. It might be nice if there was a simple way to note in the spec to go to another state, but with a modifier.

For example:

SignupForm
  submit -> Validate?
  
Validate?
  looks_good? -> SignedUp
  error? -> SignupForm*withError
  
SignedUp

#2

I’ve definitely run into the same thing. It does seem like a small difference that clutters up the spec.

The modifier is an interesting idea. As a developer reading the spec, I’m afraid I’d overlook the modifier and build the Form as a single state before realizing it needed multiple states.

To keep things tidy, I like to put the transitions under the parent instead of repeating them for each child.

To the example you provided, I’ve created child states for the Form so Validate? can transition to Invalid:

SignupForm
   submit -> Validate?
   
   Empty*
   
   Invalid

Validate?
   looks_good? -> SignedUp
   error? -> Invalid

SignedUp

#3

Interesting approach—thanks for sharing!