Now I am confused on what exactly the Board class must be responsible for. Player has a method takeTurn which in turn calls a method movePiece which belongs to the piece Class which changes the location of the piece from its current location to another location. Player class holds references to all pieces he owns and is also responsible for their creation (Should player create Pieces?). Each piece then is responsible to move itself from one square to another. Each piece also is on a square so each piece also has a reference to the square it is on. The Board is made up of squares and so Board can be made responsible for creating and managing Square objects. Please point out if there are elements of bad design (high coupling, bad cohesion etc.) and how to improve on them. This is a very broad design and my focus at this stage is just to identify who is responsible for what messages and how the objects interact each other to simulate the game. The following is an example of a chess game that I wish to design in an OO manner. I am trying to get a feel of how to design and think in an Object Oriented manner and want to get some feedback from the community on this topic.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |