?
Solved

Class vs Object Vs State daigrams

Posted on 2013-12-17
3
Medium Priority
?
1,496 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 28

Accepted Solution

by:
dpearson earned 2000 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses
Course of the Month11 days, 3 hours left to enroll

770 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