One of the more difficult things to manage when structuring an application is managing its state. This is especially true when your application can execute code asynchronously. Let's say you execute some piece of code, but something causes it to wait (such as an HTTP request or user input). After it's completed, you notice the state it's expecting changed because some other piece of code executed asynchronously and changed its value.