Zhenning Guan wrote:
> ---------
> if state == yellow
>   state = red
>   catch_runner
> end
> ---------
> instead of it.
> so why do we needs act_as_state_machine? a wrapper ? make thing simple?

You are actually illustrating the point to state machines. Yes, in this 
simple example you can implement them using a series of conditionals, 
but not every state machine is this simple. You could end up with a lot 
of conditionals and the code could end up being difficult to follow.

Good design is not always about producing the fewest number of lines. 
Sometimes a more verbose and descriptive code can improve 
maintainability.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to