Activity and Class Diagrams for Modelling Business Process Richard Hopkins rph@nesc.ac.uk UML for Use Cases NeSC, Edinburgh, Jan 5/6 2006 Development Process Capture Requirements to elucidate requirements – what entities exist Activity Diag. and how each Class Diag. behaves Partially articulated requirements Use Case Diag. Requirements Sequence Diag. Construct Model of Overall system Class Diag. … Activity Diag. UML for Use Cases, Jan 5/6 2006 Sequence Diag. Activity/Class diagrams Structure Behaviour 2 More Technical Diagrams Activity Diagram Flowchart Deals with the whole behaviour of one actor Class Diagram shows the structure of the types of entities involved in the system These are more complex diagrams Usually used for the Software design – internal operation Can be used to describe external operation Might be useful in clarifing requirements UML for Use Cases, Jan 5/6 2006 Activity/Class diagrams 3 Activity Diagram (flowchart) Swimlanes – separate Actors – persons or systems user librarian [borrower] Find Book on shelf [returner] Wait in queue [returning] [borrowing] Record loan Record return Put book back On shelf finalise decision [guard] description - verb transition UML for Use Cases, Jan 5/6 2006 activity Start / stop Synchronisation bar – Start/Collect concurrent activities “concurrent” = non-sequenced Any order or parallel Activity/Class diagrams 4 Class Diagram User Student Item Staff Member Copy Book Journal Article each box represents a class of entities here “real world” entities Generalisation (= Inheritance) Every StaffMember is a User Every Student is a User If User can do it, so can Student and StaffMember Every Book is an item; Every Journal is an item Doing something to an item means doing that to a book or to a Journal To facilitate understanding of / communicate about The application domain NOT the structure of system implementing it UML for Use Cases, Jan 5/6 2006 Activity/Class diagrams 5 Class Associations User Item has out Student Staff Member Copy Is copy of Book Is part of contains Journal Article has out Ordered print-off Associations – knows about there is an association line if there is a relevant realworld association – “any user can have out a copy (of a book)” “a Staff Member can have out a Journal “an article can be part of a Journal” …. only label one end UML for Use Cases, Jan 5/6 2006 Activity/Class diagrams 6 Multiplicities Student Number of Copy objects that can be associated with one student object : At least 0; At most 6 0..1 0..6 has out Staff Copy 0..12 0..1 0 or 1 1 1..* Is copy of Book Exactly 1 At least 1,no upper limit Constrains the number of entities at one end that can be associated with one entity of the other end (in this association type, at any one time) Either – single number (usually 0 or 1) Or range X .. Y. * for Y means no upper limit UML for Use Cases, Jan 5/6 2006 Activity/Class diagrams 7 Questions? UML for Use Cases, Jan 5/6 2006 Activity/Class diagrams 8 Practical – Business Process Model Working in groups For the system of your Use Cases or some other group’s E & F seem to me to show relatively little potential for entity structuring Construct a Class diagram of the entities involved Construct an activity diagram for (part of) the behaviour of one entity class How easy? How useful Use pencil & paper or VP-UML 2 hours (ish) UML for Use Cases, Jan 5/6 2006 Activity/Class diagrams 9