Outline § Goal diagrams § Lamsweerde’s notation (basic notation plus book) Requirements modelling § FA/SIMM notation (appended material) § UML short intro (consult home page of TDDC88) Kristian Sandahl IDA 2 Why do we do this? Goal diagrams – Lamsweedre’s notation § Models supplement natural language descriptions. § Models increase visibility Goal § Models assist elicitation Achieve [BookRequestSatisfied] § Models introduce some formality § Models can help avoiding omission errors § Models can be used both for requirements and design Type Name § Linköping research: Model-based Product Development 3 Linköpings universitet 4 Goal diagrams – AND refinement Goal diagrams – Complete refinement, with agents Achieve [BookRequestSatisfied] Achieve [CopyBorrowed If Available] Achieve [BookRequestSatisfied] Achieve [CopyDueSoonForCheckOut If Not Available] Achieve [CopyBorrowed If Available] Achieve [CopyDueSoonForCheckOut If Not Available] Responsibility Loan software Agent Staff Environment agent marker 5 Goal diagrams – OR refinement with obstruction Building goal models: Heuristic rules and reusable patterns ComprehensiveLibraryCoverage EffectiveBookSupply § Analyse current objectives and problems § Search for goal-related keywords § Instantiate goal categories § Ask How and Why questions § Split responsibilities § Identify soft goals § Identify agent wishes AccessToForeignDigitalLibrary Obstruction Obstacle IllegalCopying Resolution Countermeasure goal § Analyse obstacles § Check complementary cases of conditional goals § Refine goals until assignable to single agents § Don’t confuse goals and operations § Don’t confuse AND and OR § Avoid ambiguities TraceDownloads 7 Linköpings universitet 6 8 Use-case diagram Use-case diagram for the library Library system Actor: a user of the system in a particular role. Can be human or system. Name: a verb phrase Reserve book Browse Borrow copy of book BookBorrower Detail of use-case BookBorrower Borrow copy of book Browser Return copy of book A BookBorrower presents a book. The system checks that the potential borrower is a member of the library, and that he/she doesn’t already have the maximum permitted book on loan. This maximum is 6 unless the member is a staff member, in which case it is 12. If both checks succeed, the system records that this library member has this copy of the book on loan. Otherwise it refuses the loan. Extend loan Borrow journal Update catalog Return journal JournalBorrower Librarian 9 Please, Please,keep keepas as simple simpleas aspossible. possible. Relations between use-cases Extend loan 10 Extension points Condition: {customer selected HELP} extension point: Selection <<include>> Check for reservation BookBorrower Borrow copy of book <<include>> ”Reuse” Perform loan transaction <<extend>> Stereotype: extended classification of meaning extension points: on-line help <<extend>> Selection Refuse loan ”Separating scenarious” 11 Linköpings universitet 12 Identifying classes: noun analysis A BookBorrower presents a book. The system checks that the potential borrower is a member of the library, and that he/she doesn’t already have the maximum permitted book on loan. This maximum is six unless the member is a staff member, in which case it is 12. If both checks succeed, the system records that this library member has this copy of the book on loan. Otherwise it refuses the loan. The single class model •book – real noun handled by the system •system – meta-language Book name •borrower – already actor •library member – handled by the system title: String •staff member – handled by the system attribute copiesOnShelf() : Integer borrow(c:Copy) •checks – event operations •copy of book – handled by the system 13 The library class model 14 More relations between classes 1..* 10..* Topic Book Link aggregation Volume composition Square qualified association 1 1 is a copy of 1..* LibraryMember borrows/returns 0..1 0..* Copy Board generalisation MemberOfStaff 0..1 1..* Encylopedia is a copy of borrows/returns 0..* Copy Journal 1..* 1..* 0..* 15 Book constraint {xor} is a copy of Linköpings universitet 1 row:{1,2,..8} 1 column:{1,2,..8} 0..* Journal 16 Combining fragments of sequence diagrams Continue modelling :Sequence diagram SD processOrder theLibraryMember: LibraryMember theCopy: Copy :Order theBook: Book :TicketDB :Account create aMember: BookBorrower ref Get existing customer data borrow(theCopy) A 1: okToBorrow 2: borrow {C-A < 5s} loop {borrowed’ – borrowed < 1s} 2.1: borrowed loop [get next item] reserve(date,no) loop condition add(seats) answer C destruction 17 More fragments of sequence diagrams :Order 18 State diagram :TicketDB For class Copy: start marker object loop [get next item] reserve(date,no) alt [available] guard condition nested conditional on loan message this object return()/book.returned(self) on the shelf borrow()/book.borrowed(self) add(seats) alternate branches reject [unavailable] state 19 Linköpings universitet event, causing transition action, reaction to the event 20 State diagram with guards Wiht WihtOCL, OCL,Object Object Constraint ConstraintLanguage, Language,this this becomes becomesvery verypowerful powerful For class Book: returned() not borrowable returned() borrowable borrowed()[last copy] borrowed()[not last copy] 21 Linköpings universitet www.liu.se