Solved

Class vs Object Vs State daigrams

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

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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
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…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
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.

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now