refactor: decouple match result announcement - #376
Merged
Merged
Conversation
* Move match result presentation out of MatchResult and MapRotationService into MatchResultAnnouncer. * Remove the presentation-specific Announcement property from MatchResult and update its tests accordingly. * Register MatchResultAnnouncer with LoadingMapEvent so map rotation only signals that a new map is being loaded without knowing how the match result is presented.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
MapRotationServicewas responsible for announcing match results in addition to coordinating map rotation.This caused the map rotation logic to depend on
MatchResultand presentation-specific message formatting.The
MatchResultdomain model also contained anAnnouncementproperty solely for this presentation concern.The match result should represent the outcome of the match without knowing how that result is presented to players.
The match result is announced when a new map begins loading, but
MatchResultAnnouncerexposesAnnounce()to describe its actual responsibility rather than the event that triggers it. The map loading event is only the mechanism used to invoke the announcement.Changes
Announcementproperty fromMatchResult.MatchResultTeststo remove presentation-specific assertions.MatchResultdependency fromMapRotationService.MatchResultAnnouncerto handle match result presentation.MatchResultAnnouncer.Announce()as its public operation.MatchResultAnnouncer.Announce()to theMapRotationService.LoadingMapEventevent.Benefits
MapRotationServiceis no longer coupled to match result presentation.MatchResultnow represents only the outcome of the match.MatchResultAnnouncer.