Welcome to Dream.In.Code
Getting Help is Easy!

Join 132,351 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,130 people online right now. Registration is fast and FREE... Join Now!




UML Help

 
Reply to this topicStart new topic

UML Help

skin__
post 23 Aug, 2008 - 09:29 PM
Post #1


New D.I.C Head

*
Joined: 20 May, 2008
Posts: 37

Hi guys,

I need to write a UML diagram for a game of Connect Four but I'm really lost with how to do this.
Can anyone help me? I'm just reading over about ADTs and UMLs now.
User is offlineProfile CardPM

Go to the top of the page

Martyr2
post 24 Aug, 2008 - 08:00 AM
Post #2


Programming Theoretician

Group Icon
Joined: 18 Apr, 2007
Posts: 5,027



Thanked 173 times

Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions


Well the first step to doing UML is to first identify any objects you have. These will appear as boxes and will have properties and actions with them. Second you will identify what they call "actors" or people who interact with these objects. These usually appear as little stick figure guys. In Connect 4 there are two players but as far as the system is concerned there is only one actor, the current player.

Some objects you might have would be... board (where pieces are going to be contained), piece (the actual colored piece that you will place in the board) and Game which would keep track of things like who's turn it is, the player's color, who won and lost and would contain the current board setup and game restart.

Once you have identified the objects and actors, you try to fill in the responsibilities of each object and, as I have already helped you do above, identify the properties and methods of each object and how they interact with one another. Obviously the game object is going to handle the creation of a new board object, the board will interact with pieces as well as their position in the board, might have a function to check if someone created 4 in a row etc.

Read up on the game and you can quickly see how these objects might work with one another. Be mindful of all the objects in the game and the actions each object might take when working with the other objects. These are going to form your relationships in the UML diagram.

Below is an example of a UML diagram. Your's should be around the same size or so. Notice how the order object interacts with a client and an order string object. Also notice how the client has been inherited down into two types of clients. You could inherit down into a red and a black piece from "piece" but I think you won't have to as long as you make a property of piece called "color".

UML Class Diagram example

Another example which is a bit more complex shows actors and such...

UML Diagram with actors and a bit more complex scheme (Yours should be no where near this complex... this UML is for a Portal system)

Hope this helps give you an idea of what it should look like.

"At DIC we be UML mastering code ninjas... we also mastered gantt charts, timelines, and women. Ok I lied about the last one." decap.gif

User is offlineProfile CardPM

Go to the top of the page

skin_
post 24 Aug, 2008 - 11:05 PM
Post #3


New D.I.C Head

*
Joined: 5 Apr, 2008
Posts: 33

Thanks heaps for that detailed reply, I really appreciate you posting in my UML thread. I'm having a bit of difficulty understanding what to do next after identifying all the classes.

This is what I have so far:
IPB Image

Does this look right so far? Do you think you could help me advance to the next part, which I guess would be to identify the attributes and methods.

This post has been edited by skin_: 25 Aug, 2008 - 12:23 AM
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/22/08 04:00AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month