Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I realise these two diagrams are very similar, with the obvious difference one models the sequence of a certain function, whilst the other models the state throughout a function being carried out.

The differences that I have identified are as follows - probably incorrect:

  1. State chart is more of a logical view of any functionality, showing a wider array of deviating paths - however, saying that, sequence diagrams also have the ability to provide alternate (alt) paths, conditions, loops etc.
  2. A sequence diagram is aimed at one specific function, e.g. withdrawing money from your bank account, whereas a state chart can model a whole system.

State chart example & Sequence diagram example

share|improve this question

1 Answer 1

up vote 6 down vote accepted

Scott Ambler provides a very good overview of UML sequence diagrams and UML state chart/machine diagrams.

Your differences aren't actually that far from the truth, though.

A sequence diagram typically shows the execution of a particular use case for the application and the objects (as in instances of a class) that are involved in carrying out that use case. It could either show a single path, or all of the various paths, through the use case, starting with an actor (user, external system, event) initiating some kind of action.

State diagrams show the various states that are valid for an object (which could be anything from a method to a class to the system as a whole). That could be a particular class or the system as a whole. This type of diagram shows what actions are valid for a given object, depending on what state it is currently in.

share|improve this answer
    
Cheers for the links, I'll take a thorough read through them both! –  Prisoner Aug 19 '11 at 13:27
2  
@Prisoner I would highly recommend all of Scott Ambler's work - most of it is a straightforward read that's very informative. –  Thomas Owens Aug 19 '11 at 13:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.