Solved

Class vs Object Vs State daigrams

Posted on 2013-12-17
3
1,483 Views
Last Modified: 2014-06-30
I would like to know when, where, why we use
Class vs Object Vs State daigrams.


What are practical uses, advantages of each of them.

please advise
Any links resources ideas highly appreciated. Thanks in advance
0
Comment
Question by:gudii9
3 Comments
 
LVL 27

Accepted Solution

by:
dpearson earned 500 total points
ID: 39733330
1) A class diagram shows the static relationships between classes.  A common example is a class hierarchy like this one for Java's AWT library:
http://www.ged.fi/DesignPatterns/AWT.gif

Class diagrams are very common.

2) A state diagram shows the flow of a process - the different states that you can be in and how those states are allowed to change.  E.g. When you use an ATM you can be in a series of different states (e.g. have you entered your PIN number yet or not).  Here's an example of a state diagram for an ATM:
http://people.engr.ncsu.edu/efg/210/s99/Notes/fsm/atm.gif

State diagrams are also quite common as a way to represent a process that happens over time.

3) An object diagram shows a snapshot in time - the relationship between a set of specific objects.  Here's an example of an object diagram:
http://static1.creately.com/blog/wp-content/uploads/2012/01/UML-Object-Diagram.png

The key is that it's showing specific instances (e.g. order_number=0001), not just general relationships between classes.

Personally I've never seen anyone have to draw an object diagram.  Class diagrams and state diagrams are both much more common as they deal with the general behavior of the system - not a specific moment in time (as an object diagram does).

Hope that helps,

Doug
0
 
LVL 7

Author Comment

by:gudii9
ID: 39738546
where can i find lot of examples, diagrams of above kind and good resources to refer.

In the state diagram

http://people.engr.ncsu.edu/efg/210/s99/Notes/fsm/atm.gif

what each circle represents?
Please advise
0
 
LVL 21

Expert Comment

by:Amitkumar Panchal
ID: 40167041
Circle represents a state and a line represents an input/event/action.

In attached snap below can be the examples of state:
- Waiting for card
- Waiting for PIN
- Waiting for choice (Withdraw/Deposit)
- Waiting for amount
- Waiting for confirmation

and

sn on.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question