Solved

Class vs Object Vs State daigrams

Posted on 2013-12-17
3
1,473 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 26

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Basic Java Case or If-Else statement... 3 50
Java SE 8u111  Lot of stuff broke 11 68
diffSum example 4 36
couple of eclipse 5 36
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

805 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