mercredi 10 février 2021

Doubts about the architecture of a problem using design pattern

I have a simple problem to solve but I have some doubts about the architecture I have to implement, I have several ideas but I am afraid of not following the SOLID principles. The problem is the following.

I would like to develop a baseball scoreboard that shows the matches and the baseball score for each match. The baseball score board allows you to add a new match to the score board, delete a match when it ends, update the score of a match given the match and get the score of a team, given the name of the team.

This are the classes I have made.

public class Match
{
    public Team Team1 { get; set; }
    public Team Team2 { get; set; }
    public Score Score { get; set; }
}

public class Team
{
    public string Name { get; set; }
}

public class Score
{
    public int Team1Score { get; set; }
    public int Team2Score { get; set; }
}

public class ScoreBoard
{
    public List<Match> Matches { get; set; }
    public void AddMatch(Match match){}
    public void RemoveMatch(Match match){}
    public void UpdateScoreMatch(Team Team1, Team Team2){}
    public int GetTeamScore(Team Team1){}
}

Do you think that I am violating the principle of single responsibility? Any advice for this problem. I was thinking of making interfaces, but I'm not sure about that, I'd like to do it another way.

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire