jeudi 2 février 2017

SOLID design principles, GUI and Model abstraction

I have a data structure like so

League --< Rounds ---< Games ---2 Players

However, when a round is created it needs to know what Pairing method is chosen on the GUI, prior to creation, so it knows how to pair the teams.

Can anyone over advice on how to implement this? I want to keep the model seperate from the GUI but I can't create a round object without knowing the selected Pairing method. And I am not sure what the best way to implement the pairings is.

I've thought something like

interface IPairingMethod{}
public class RoundRobin:IPairingMethod{}

And use DI in the Round constructor but it doesnt seem clean. Would the factory pattern help?

Aucun commentaire:

Enregistrer un commentaire