I found another interesting application for configuration and state recently.
We were discussing events. The user presses a button, a request goes to a service, and it starts a process. They were saying the start event is when the user presses the button, and the end event is when the service finishes processing.
Wrong!
The user pressing the button is a command - a configuration. Events are related to the service starting something or finishing something - so it is state.
The correct design is that when the service starts processing the command to start doing the work, then its state is "started" - so that is when the event should be fired. Same for when the work gets done.
No comments:
Post a Comment