Skip to content
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

Use public factory methods to create participants #53

Open
jzwang8 opened this issue Jul 17, 2020 · 0 comments
Open

Use public factory methods to create participants #53

jzwang8 opened this issue Jul 17, 2020 · 0 comments
Assignees
Milestone

Comments

@jzwang8
Copy link
Collaborator

jzwang8 commented Jul 17, 2020

Comment on PR by Kevin:
"A potential cleanup for a future PR could be to make this constructor private and instead use public factory methods to create participants. Some of the code that calls this now has to specify fields that don't make sense for their particular case. For example, creating a new unmatched participant requires the caller to explicitly include the MatchStatus and a zeroed out match ID. Not only does this lead to more LOC, but it also leaks a small detail that 0 is this class' default value for matchId.

A factory method might look like

  return new Participant(username, startTimeAvailable, endTimeAvailable, /* matchId= */ 0, MatchStatus.UNMATCHED, timestamp)
}```
which requires two fewer arguments because an unmatched participant will always have the unmatched enum value and zeroed match ID."
@jzwang8 jzwang8 self-assigned this Jul 17, 2020
@jzwang8 jzwang8 modified the milestones: prototype, mvp Jul 17, 2020
@jzwang8 jzwang8 modified the milestones: mvp, product-alpha Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant