6

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

1 Answer 1

10

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.

2
  • Cheers for the links, I'll take a thorough read through them both!
    – Prisoner
    Commented Aug 19, 2011 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
    Commented Aug 19, 2011 at 13:29

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