Question

  • I have these uml diagrams. They are diagrams of a game called Tictactoe. Just a simple tictactoe with scoring. So i would like you to check or give an opinion of my diagrams if it is correct or needs improvements.
  • here are the diagrams:

uml1

uml2uml3![][3]

uml4

Acitivity diagram Class diagram Usecase diagram Statechart diagram

Was it helpful?

Solution

Simple answer: the diagrams are incorrect.

Without even looking at the problem-domain aspects of the diagrams, there are glaring problems.

1) Your activity diagram cannot possibly work. All incoming connections must offer tokens before an action can start; thus, SwitchCurrentPlayer can never start. You may find a related answer helpful: activity diagram - call operation example with parameters?

2) Your class diagram does not have association-end names. You have two properties of type Board in Tictactoe and two properties of type Tictactoe in Board.

OTHER TIPS

Yeah it looks pretty good. Though I am suspicious with the composition Player to TickTackToe. I mean the class itself can exists even without the player.

And the user in the activity diagram should terminate the game too. Don't forget that function.

  • first activity diagram

    • After the second decision you have missed one more decision - is the board full? If yes - go to tie, if not, viz the next point
    • you have missed the loop . You can show it as return from the third decision or covering all repeating actions by loop fragment element.
  • The last diagram. You have to do the return AFTER check, not before it. Or you'll have infinite loop.

  • Class diagram

    • you don't need pieces as classes - make the board consisting of cells and each cell has a state taken from enumeration Pieces( x,o) or null, and a function putPiece(Pieces)
    • TickTackToe
    • should have fields currentPiece and currentPlayer.
    • Where are functions and fields mentioned in other diagrams. You should make class diagram on their base.
    • What is player2 field for?

Activity diagram:

Your activity diagram allows to execute action "move First" or "Move Second" only once and you must start whole activity again to continue. Player is not a participant. Game is only participant. When you start game, it must wait for event "start". After event occured, you can wait for "Move First" or "Move Second" event. You have to switch player after some of move events occured. I think, you activity diagram does not need to have final nodes. When you turn off game, activity i stopped. Activity defines behavior. Behaviorn can by set as classifier behavior and activated within creation of classifier instance.

Class diagram:

Player is not in composition with game

UseCase:

I would say that UseCases you defined are steps of activity diagram. Meaninfull usecases would be "Play Game" or maybe "Show Score".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top