AASM exmaple
AASM is "Acts As State Machine"
Originally written as a Rails plugin,
later evolved to a stand alone generic library.
I've written an example to demonstrate the usage here:
AASM example
Well, I am not so satisfied for its design,
but it's usable still. Some comments:
1. To bang! or not to bang?
Ruby: bang means dangerous, e.g. side-effect
Rails: bang means raising exception
AASM: bang means save
I hate that everyone invents its semantics of bang.
That is very, very confusing.
2. Didn't provide a good way to do state pattern
3. Not so configurable, always raise exception
when it can't find a proper state transition.
4. Not so documented. The example in README is
broken, and I need to dig into the source.
But I think I may misuse AASM, since I am not
familiar with finite state machine...
0 retries:
Post a Comment
Note: Only a member of this blog may post a comment.