From 549f6b20ef9c881d8c186739207be69cd8d2f7f7 Mon Sep 17 00:00:00 2001 From: Raimo Niskanen Date: Mon, 16 Apr 2018 11:07:04 +0200 Subject: Fix after feedback on 'When to use' --- system/doc/design_principles/statem.xml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'system/doc/design_principles/statem.xml') diff --git a/system/doc/design_principles/statem.xml b/system/doc/design_principles/statem.xml index c44f240098..ed6338e306 100644 --- a/system/doc/design_principles/statem.xml +++ b/system/doc/design_principles/statem.xml @@ -93,10 +93,10 @@ State(S) x Event(E) -> Actions(A), State(S')

- Gathered callback code for each state, + Co-located callback code for each state, regardless of - Event Types. - (such as calls, casts and infos) + Event Type + (such as call, cast and info) @@ -114,15 +114,14 @@ State(S) x Event(E) -> Actions(A), State(S') State Enter Calls - (callback on state entry gathered with the rest + (callback on state entry co-located with the rest of the state callback code) - Higher level timeouts - ( - State Time-Outs, + Easy-to-use timeouts + (State Time-Outs, Event Time-Outs - or + and Generic Time-outs (named time-outs)) @@ -133,14 +132,14 @@ State(S) x Event(E) -> Actions(A), State(S') gen_server.

- For simple state machines not needing these fetures + For simple state machines not needing these features gen_server works just fine. It also has got smaller call overhead, but we are talking about something like 2 vs 3.3 microseconds call roundtrip time here, so if the server callback does just a little bit more than just replying, - or if the callback is not extremely frequent, + or if the call is not extremely frequent, that difference will be hard to notice.

@@ -256,7 +255,7 @@ State(S) x Event(E) -> Actions(A), State(S') With state_functions, you are restricted to use atom-only states, and the gen_statem engine branches depending on state name for you. - This encourages the callback module to gather + This encourages the callback module to co-locate the implementation of all event actions particular to one state in the same place in the code, hence to focus on one state at the time. @@ -1686,7 +1685,7 @@ open(state_timeout, lock, Data) -> It can sometimes be beneficial to be able to generate events to your own state machine. This can be done with the - + State Transition Action {next_event,EventType,EventContent}. -- cgit v1.2.3