Conversation
|
@j0ran thanks for your pull request, you say this is a simplified for which a better solution exists, could you describe what the better solution is and in what cases the simpler solution doesn't work or becomes impractical? I'm not sure when to use the Invariant pattern you described. |
|
In this case, you could, for example, make a timer that keeps sending timeouts until you stop it. Then you will receive unexpected timeouts if you don't stop the timer and no events if you don't start it. When to use it? When you feel you can not ensure a certain invariant is being held. It really depends on the situation. I noticed when using this pattern that often I found another design that would ensure a certain invariant. But not always. I still use it for a component to ensure I am subscribed to status messages when it is operational or locked. The invariant pattern is just another tool in your toolbox. Do you want me to add these explanations to the discussion in the README.md? |
No description provided.