It's not a secret anymore!*
The moose likes OO, Patterns, UML and Refactoring and the fly likes State Diagrams - HOWTO implement them? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "State Diagrams - HOWTO implement them?" Watch "State Diagrams - HOWTO implement them?" New topic
Author

State Diagrams - HOWTO implement them?

Desai Sandeep
Ranch Hand

Joined: Apr 02, 2001
Posts: 1157
Hi,
Martin Fowler in his book UML Distilled differentiates between action (as transitions) and activities (as states).He mentions about events associated to actions in the form event[guard]/action
I have a couple of queries on this :

  1. Can we find out who has triggered the event shown as action by the State Diagram?If not, which UML artifact would show this?
  2. Wanted some more information/illustrations on implementation of State Diagrams - Any online information on this?Has anyone gone through Real-time UML by Douglass, which Martin Fowler refers to for implementation of State Diagrams?

  3. Thanks in advance,
    Sandeep
    [This message has been edited by Desai Sandeep (edited June 01, 2001).]


<b>Sandeep</b> <br /> <br /><b>Sun Certified Programmer for Java 2 Platform</b><br /> <br /><b>Oracle Certified Solution Developer - JDeveloper</b><br /><b>-- Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java </b><br /><b>-- Object-Oriented Analysis and Design with UML</b><br /> <br /><b>Oracle Certified Enterprise Developer - Oracle Internet Platform</b><br /><b>-- Enterprise Connectivity with J2EE </b><br /><b>-- Enterprise Development on the Oracle Internet Platform </b>
Paul Michael
Ranch Hand

Joined: Jul 02, 2001
Posts: 697
i'm also interested in knowing the significant differences between state and activity diagrams... hope our fellow ranchers here would help us... many thanks!


SCJP 1.2 (89%), SCWCD 1.3 (94%), IBM 486 (90%), SCJA Beta (96%), SCEA (91% / 77%), SCEA 5 P1 (77%), SCBCD 5 (85%)
nitin kumar
Ranch Hand

Joined: May 14, 2002
Posts: 105
A state chart diagram corresponds to a single class.We usually extrapolate object modes to class state.For instance if account is treated as object then it has 2 modes closed and opened thus illustarting the valid states.
A state chart diagram illustartes the valid states and valid state transitions and which events trigger the state transition.
Activity diagrams are the old style flow chart and are used for complex use cases
nitin kumar
Ranch Hand

Joined: May 14, 2002
Posts: 105
An activity diagram is a special form of state diagram used to model a sequence of actions and conditions taken within a process. The modeled process may be at the organizational level or at the system level. One of the most valuable uses of the activity diagram is during operation design
UML activity diagrams document the logic of a single operation or method, a single use case, or the flow of logic of a business process. In many ways, activity diagrams are the object-oriented equivalent of flow charts and data-flow diagrams (DFDs) from structured development. Activity diagram is interesting because it may cuts across the logic of several of the use
cases
Activity diagrams are a useful behavioral modeling tool for the following reasons:
They describe the internal behavior of an operation pictorially
They depict activities that can occur in parallel
They help to identify activities whose responsibility belongs elsewhere
They allow the discovery of common functionality within a system
They can be used as coding specifications
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
Welcome to the Ranch niti
Please read our naming policy and adjust your displayed name accordingly.
Desai, have you read the examples given in Thinking in Patterns at bruceeckel.com ?


SCJP2. Please Indent your code using UBB Code
nitin kumar
Ranch Hand

Joined: May 14, 2002
Posts: 105
no i did not go thru that site.I will go thru it
Adrian Ferreira
Ranch Hand

Joined: May 29, 2000
Posts: 118

Can we find out who has triggered the event shown as action by the State Diagram?If not, which UML artifact would show this?

A stage diagram is related to one specific entity, normaly one object. As always you can use a stereotype. You can also link another diagram that shows more detais. If the intetion is primarily to show this interaction, sequence or collaboration diagrams should be used.

Wanted some more information/illustrations on implementation of State Diagrams - Any
online information on this?

They are normaly implemented as an attribute of the object. If you have many states and wnat to avoid usind switch/case command you can use State Pattern described in Larman's book , 2nd edition, pg. 554 or GoF, pg 305.
Online, I found this simple tutorial:
State pattern
Adrian
[ August 15, 2002: Message edited by: Adrian Ferreira ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: State Diagrams - HOWTO implement them?
 
Similar Threads
Activity diagrams
Collaboration Diagrams
Different Navigabilities?
Creater Pattern - Can it model Attributes?
my woes