Applying the single responsibility principle to a chessboard application, what should a Piece interface/class be responsible for?
I am sure it needs to know its colour, type and valid moves. But should it also know its position (x/y) in the board? Or, should the board know the position of each piece.
This decision also has some consequences on how the piece can move in that, does the board decide what a valid move is for a piece etc
Aucun commentaire:
Enregistrer un commentaire