1 / 41

Conceptual Design: UML Sequence Diagrams

Conceptual Design: UML Sequence Diagrams. Object Responsibilities. Attributes - “What I know about myself” Relationships - “What I know about other Classes and Objects” Operations - “What I do”. Operations. Synonyms: methods, functions & services

denis
Download Presentation

Conceptual Design: UML Sequence Diagrams

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Conceptual Design:UML Sequence Diagrams

  2. Object Responsibilities • Attributes - “What I know about myself” • Relationships - “What I know about other Classes and Objects” • Operations - “What I do”

  3. Operations • Synonyms: methods, functions & services • Definition: Actions performed to fulfill the purpose of the information system and meet the needs of the user. • Respond to an event that happens: • External events - business activities • Internal events - messages sent to accomplish an operation’s intended purpose

  4. Types of Operations • Basic - implied or implicit (not listed) • create a new object • search for an object • get and set attribute values • connect and disconnect object associations • delete an object • Problem domain – specific to the domain being studied

  5. Thinking… you think.... ClassName Template attributes - inherited - local ClassName attributes 1) basic operations 2) problem domain specific operations - inherited - local operations

  6. Problem Domain Operations Example Student studentIDNumber studentName etc... registerForCourse dropCourse requestTranscript payStudentFees etc... • next....Basic Services Examples...

  7. NEW Operation Example new Student Student 4 Student 3 Student 3 Student 2 Student 2 Student 1 Student 1 Student Student attributes attributes operations operations after before • Note: All basic operation examples are for illustration • only as each implementation language handles them differently

  8. SEARCH Operation Example #1 search[Student, studentIDNumber = 123-45-6789] Student 3 Student 3 Student 2 Student 2 Student 1 Student 1 Student Student StudentID Number: 123-45-6789 attributes attributes operations operations

  9. SEARCH Operation Example #2 search[Student, studentName = “Smith”] Student 3 Student 3 Student 2 Student 2 Student 1 Student Name: Smith, Mary Student 1 Student Student Student Name: Smith, John attributes attributes operations operations

  10. GET Operation Example Student 3 Student 2 get[Student=“Student2”, telephone] result: telephone = (619)588-3296 Student 1 Student telephone: (619) 588-3296 attributes operations

  11. SET Operation Example set[Student, telephone,(619)594-3736] Student 3 Student 3 Student 2 Student 2 Student 1 Student 1 Student Student telephone: (619) 588-3296 telephone: (619) 594-3736 attributes attributes operations operations after before

  12. CONNECT Operation Example connect[StudentClub=AITP Club, ClubMember=AITP-Student N] AITP-Student N AITP Club AITP-Student 1 Beta Sigma Pi Club BSP-Student N ACM Club BSP-Student 1 StudentClub ACM-Student N ACM-Student 1 ClubMember attributes attributes operations operations

  13. DISCONNECT Operation Example disconnect[StudentClub=AITP Club, ClubMember=AITP-Student N] AITP-Student N AITP Club AITP-Student 1 Beta Sigma Pi Club BSP-Student N ACM Club BSP-Student 1 StudentClub ACM-Student N ACM-Student 1 ClubMember attributes attributes operations operations

  14. DELETE Operation Example delete[Student 2] Student 3 Student 3 Student 2 Student 1 Student 1 Student Student attributes attributes operations operations after before

  15. Problem Domain Operations • “Come in all sizes and shapes” • May be unique to the problem domain • Consider encapsulation and reuse when designing • Some respond to external events... • Others respond to internal events • Details of each operation are documented via UML diagrams and other techniques

  16. Problem Domain Operation Example #1 calculateMilesDriven[VIN = 12345, totalMiles] calculateMilesDriven VIN: 12345 17,489 17,924 totalMiles = endingMileage - beginningMileage Automobile beginningMileage endingMileage (sample): 435 = 17,924 - 17,489 calculateMilesDriven

  17. Problem Domain Operation Example #2 salesTaxOwed[VIN = 12345, taxRate, totalTax] salesTaxOwed totalTax = rentalCharge X taxRate VIN: 12345 $279.00 Automobile rentalCharge (sample): $21.62 = 279.00 X .0775 salesTaxOwed

  18. Problem Domain Operation Example #3 checkReturnDate Report For each Automobile If scheduledReturnDate less than Today send vehicle information message to overdueVehicleReport Endif End For Each vehiclesOverdueReport message sent to Automobile’s checkReturnDate operation (sample): VIN: 12345 scheduledReturnDate: 05/05/95 Today’s Date: 04/30/95 overdue: No VIN: 12654 scheduledReturnDate: 04/28/95 Today’s Date: 04/30/95 overdue: Yes (will be on report) etc.... checkReturnDate[listOfVehicles] Automobile scheduledReturnDate checkReturnDate

  19. Encapsulation and Reuse Operation Example Student SomeOtherClass(es) enterStudentIDNumber validateIDNumber enterClassScheduleNumber validateClassScheduleNumber checkSeatAvailability checkStudentRestrictions reserveSeatInClass addCourse NOTE: The addCourse service requests the assistance of each of the other services (which are either part of the Student Class or some other Class within the information system) in order to carry out its intended purpose. addCourse responds to external event; others respond to internal event

  20. Finding Operations • Identifying events and associated operations • Identify Class states - attribute values • Identify needed messages • Specifying details of known operations

  21. Describing Operation Details • UML Sequence Diagram • UML Collaboration Diagram • UML State Diagram • UML Activity Diagram • Structured English or Pseudocode • Decision Tables and Decision Trees

  22. Object1 Object2 ObjectN Message1() Message2() Message3() Message4() UML Sequence Diagram • Is an interaction diagram that emphasizes the time ordering of messages • Also referred to as a Scenario - how a use case is realized (enacted) • Graphically, it is a 2-dimensional table that shows objects arranged along the X-axis and messages, ordered in increasing time, along the Y-axis.

  23. w: OrderEntryWindow o: Order l: OrderLineItem i: StockItem e: Employee new() prepare() * prepare() check() [check=“true”] remove() needToReorder() new() prepare() prepare() check() if check() true remove() needToReorder() if needToReorder() true new() endif new() endif [needToReorder=“true”] new() r: ReorderItem [check=“true”] new() d: DeliveryItem UML Sequence Diagram (partial) (Adapted from Fowler, M., UML Distilled, Addison-Wesley, 1997, p. 104.)

  24. Classes from the UML Sequence Diagram OrderLineItem Order StockItem OrderEntryWindow prepare() etc… check() remove() needToReorder() etc… new() etc… prepare() etc… ReorderItem DeliveryItem new() etc… new() etc… Boundary Class Problem Domain Classes

  25. Object1 1: Message() 3: Message() 2: Message() Object2 ObjectN 4: Message() UML Collaboration Diagram • Is an interaction diagram that emphasizes the structural organization of the objects that send and receive messages • Graphically, it is a collection of vertices and arcs • First, place objects as vertices; second, render the links that connect the objects as arcs; third, adorn the links with the numbered messages that objects send and receive • Optionally, can contain a path (<<local>>, <<global>>, etc.)

  26. UML Collaboration Diagram Create one of these and the other is Automatically created Collaboration Diagram

  27. UML State Diagram State 1 State 2 State 3 condition action State n UML State Diagram Template (note: each arrow should be labeled ‘condition - action’)

  28. UML State Diagram Example #1 Play Messages Button Pushed Record Button Pushed Idle Phone Rings End of message Caller Speaks Recording Outgoing Message Recording Incoming Message Rewinding Tape Playing Messages Answering a Call A telephone answering machine example (incomplete)

  29. UML State Diagram Example #2 FlightLeg Seat 1 20..350 timed out sold lock Available Locked Sold unlock

  30. UML Activity Diagram • Shows the flow from one activity to another. Activities result in actions • Can be attached to classes, interfaces, component nodes, use cases, collaborations, and operations • Is similar to a Data Flow Diagram (DFD) • Used mainly when behavior is complex • Approximates a visual programming language for the UML

  31. UML Activity Diagram Example pick show (activity) schedule show (fork) publicize show buy scripts and music hire artists build sets design lighting make costumes sell tickets (completion transition) rehearse dress rehearsal (join) perform Adapted from: Rumbaugh, J, Jacobson, I. and Booch, G., The Unified Modeling Language Reference Guide, Addison-Wesley, 1999, p. 32

  32. Structured English Example checkReturnDate operation Structured English For each Automobile If scheduledReturnDate less than Today send vehicle information message to overdueVehicleReport Endif End For Each Automobile scheduledReturnDate checkReturnDate Note: Structured English is often referred to as Pseudocode

  33. Decision Tables Conditions Rules 1. 2. 3. 4. 5. 6. 7. 8. etc.. 1... 2... 3... 4... 5... etc... Actions 1... 2... 3... etc... Decision Table template

  34. Decision Table Example #1 Rules 1 2 3 4 5 Y X Percent >=90% 89% >= Percent >= 80% 79% >= Percent >= 70% 69% >= Percent >= 60% 59% >= Percent Y X Conditions Y X Y X Y X Grade = A Grade = B Grade = C Grade = D Grade = F Actions Do the conditions cover all possible cases?

  35. Decision Table Example #2 Rules 1 2 3 4 5……... Y - - - - - Y X N Cash - - - - - X N CrCd Y Y Y - - X N Check - - - Y - X Registration Fee = 0? Payment Type Credit Card # Input? C.C. Expire Date Input? C.C. Cardholder Name Input? Bank Check Number Input? Remarks by User Input? Conditions Activate POST Button Deactivate POST Button Actions X……..

  36. Decision Trees action(s) action(s) action(s) rule 1 rule 2 rule n condition n condition n condition n condition n condition n condition n condition n condition n condition n rule 1 rule 2 rule n rule 1 rule 2 rule n rule 1 rule 2 rule n action(s) action(s) action(s) rule 1 rule 2 rule n rule 1 rule 2 rule n condition 2 condition 2 condition 2 rule 1 rule 2 rule n action(s) action(s) action(s) rule 1 rule 2 rule n action(s) action(s) action(s) rule 1 rule 2 rule n action(s) action(s) action(s) condition 1 rule 1 rule 2 rule n action(s) action(s) action(s) rule 1 rule 2 rule n action(s) action(s) action(s) rule 1 rule 2 rule n action(s) action(s) action(s) rule 1 rule 2 rule n action(s) action(s) action(s) Decision Tree template

  37. Decision Tree Example Yes Grade = A Yes Grade = B Percent >= 90%? Grade = C Yes No 89% >= Percent >= 80%? No 79% >= Percent >= 70%? No Etc... Do the conditions cover all possible cases?

  38. When to use O-O Analysis, Design, & Programming? • Graphical User Interfaces (GUI) • Event-Driven Programming • Heterogeneous Environments • Distributed Environments • More sophisticated applications • Persistent Data requires: • Audio • Video • Graphics • Other non-row/column data • Higher utilization of REUSE practice • Etc...

  39. Alternative O-O A, D, & P Strategies ANALYSIS DESIGN PROGRAMMING Structured Structured Object Object Object Object Structured Object Structured Object Object Object Object Object Conventional 3-4GL Conventional 3-4GL Mixture - Conv/Obj. Object • There are all kinds of variations on these or other strategies • ODBMS, Relational, and Extended-Relational DBMS are options

  40. OO PROGRAMMING: ROCK SOLID! Pure OOP versus enhanced deterministic languages • Simula - late 1960’s • Smalltalk since 1970’s; Xerox Star in 1981 • Eiffel - Bertrand Meyer • Delphi (Borland.Com or Inprise) • Java (Sun) & Visual J Languages • C++ (Borland, Microsoft) • Objective C • Ada • Object Pascal • Object COBOL • Visual FoxPro • Powerbuilder • Visual Basic • etc... Pure Enhanced

More Related