You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wonder if it'd be worthwhile to remove GameLog's reference to game and replace it with dependency injection.
GameLog currently has a reference to a game or a match. GameLog modifies game with a config object and "replays" actions on game. Unfortunately, game is a large class with lots of dependencies, making it very difficult to mock and test.
Instead, GameLog could be rewritten with dependency injection, instead of requiring a game reference. This will allow it to be more easily tested in isolation and simpler. And it'll move the modifications to game to game, where one would normally look for it.
While we're at it, would it be acceptable to modify the serialized format? It's currently more fidgety than necessary.
The current log prefix format is:
return 'AB-' + version + '@' + this.today + ':';
It's harder than necessary to pull apart.
Incorporating the prefix fields - date and game version - into the log object and using JSON.stringify would be much simpler.
I wonder if it'd be worthwhile to remove GameLog's reference to game and replace it with dependency injection.
GameLog currently has a reference to a game or a match. GameLog modifies game with a config object and "replays" actions on game. Unfortunately, game is a large class with lots of dependencies, making it very difficult to mock and test.
Instead, GameLog could be rewritten with dependency injection, instead of requiring a game reference. This will allow it to be more easily tested in isolation and simpler. And it'll move the modifications to game to game, where one would normally look for it.
Sounds good! 👍🏻
While we're at it, would it be acceptable to modify the serialized format? It's currently more fidgety than necessary.
The current log prefix format is:
return 'AB-' + version + '@' + this.today + ':';
It's harder than necessary to pull apart.
Incorporating the prefix fields - date and game version - into the log object and using JSON.stringify would be much simpler.
We could start the serialized log with 'AB-'.
Thoughts on this?
Makes sense, ideally JSON.stringify will keep the version and date human readable if opening a saved log file with a text editor.
Sure, if it's important to see the date and version in clear text, we can keep it in clear text and also serialize/covert to base64.
It won't increase the file size much.
If we can change the log format, I'll keep the prefix, but throw away the clear text version — it's just easier and more flexible to parse JSON.
We can forward to the existing function so we don't break old logs, though since the game is evolving, they'll probably eventually be phased out anyway.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I wonder if it'd be worthwhile to remove
GameLog's reference togameand replace it with dependency injection.GameLogcurrently has a reference to agameor amatch.GameLogmodifiesgamewith aconfigobject and "replays" actions ongame. Unfortunately,gameis a large class with lots of dependencies, making it very difficult to mock and test.Instead,
GameLogcould be rewritten with dependency injection, instead of requiring agamereference. This will allow it to be more easily tested in isolation and simpler. And it'll move the modifications togametogame, where one would normally look for it.While we're at it, would it be acceptable to modify the serialized format? It's currently more fidgety than necessary.
The current log prefix format is:
return 'AB-' + version + '@' + this.today + ':';It's harder than necessary to pull apart.
Incorporating the prefix fields - date and game version - into the log object and using
JSON.stringifywould be much simpler.We could start the serialized log with 'AB-'.
Thoughts on this?
All reactions