opened
joaomdmoura
username_0
Relate to issue #9
Update Machinery DSL, decoupling it from the Struct itself
issue
created
rawkode
username_1
Hey,

It's a shame to see this reversal in API. I don't believe that one should decouple the model and business logic. What is a model, if not the business logic?
comment
created
joaomdmoura
username_0
Hey @username_1 thanks for expressing your concerns. I do believe in decoupling business logic from models in some cases. In this case I do think it makes sense, also because it feels more functional.
The main reasons why I believe its worth to have your state machine logic into its own modules are:
1. Avoid the usual anti-pattern known as fat model.
1. Otherwise this logic wouldn't only live in the model but could easily leak to other modules as well.
1. That also would allow you to have multiple state machines for the same model. (that's an edge case, I know and probably not okay for most cases)
comment
created
rawkode
username_1
Can you elaborate on this?

When I define a module / model for a `TrafficLight` and store the state machine in it's own module, `TrafficLightStateMachine`, what would even exist inside the `TrafficLight` module? What is it's purpose?

I appreciate your library and only ask questions so that I can understand the direction your library is headed. I hope you do not mind these questions.

Thanks
comment