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

Schedule generation for Leagues should be a PORO and also be tested that way #423

Open
Askir opened this issue Jan 23, 2018 · 0 comments
Open

Comments

@Askir
Copy link
Contributor

Askir commented Jan 23, 2018

Since Schedule generation is quite independent of the model itself it is way too much logic in the models class and should be extracted into a PlainOldRubyObject(PORO), that handles all the edge cases and encapsulates how the schedule specifically is generated.
Tests for this should also be extracted from league_spec.rb and could potentially use moc-objects for the event objects, to speed things up a little bit if needed.

What this accomplishes:

  • Encapsulates algorithms into their own file and classes so that you don't have to search the huge model file for the correct lines if you want to change anything
  • Decouples the algorithms from the League class so that in theory you can use them with other events aswell
  • Improves readability, by allowing more names and more submethods without cluttering the model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant