-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explicit States in EventLoop.hs #14
Comments
How to implement that? There are 2 options:
|
I would aim at making illegal states impossible, as much as possible |
Then, a description of the Model is reqired in plain text. From that, a suitable data structure can be derived |
About making illegal states impossible: It seems hard and kind of impossible to actually do that since the state is determined at runtime.
|
First step of the refactoring has been implemented by #16 |
Explicit State
The
EventLoop.hs
is the core file for the Server Application. It manages multiple connections, it manages the communication, server updates, also whether the game has started, when a game is over, et cetera...These are a lot of responsibilities, and a lot of the message handling is dependent on the current state.
However, the current state of the server and the various client connections are only present through implicit conversion of the current state variables.
My proposal would be, to refactor the server variables to include a more explicit state machine. Hence, messages should have it easier to determine the current state. It should even improve performance by avoiding costly variable analysis during handling a message.
The text was updated successfully, but these errors were encountered: