Скачать презентацию Software Engineering CSC 221 Lecture 3 Domain modeling Скачать презентацию Software Engineering CSC 221 Lecture 3 Domain modeling

d7acbcf06fabcd1c1a2f6a56dfc0632a.ppt

  • Количество слайдов: 62

Software Engineering, CSC 221, Lecture 3 Domain modeling 3/15/2018 1 Software Engineering, CSC 221, Lecture 3 Domain modeling 3/15/2018 1

Overview of the Last Lecture n Software Development Models q q q n Waterfall Overview of the Last Lecture n Software Development Models q q q n Waterfall Model Evolutionary Models Incremental Model Spiral Model Unified Process Overview of UML q q q 3/15/2018 History 4 + 1 View models Using UML in UP 2

Overview of This Lecture n n n Introduction to Case Studies Requirement Gathering Use Overview of This Lecture n n n Introduction to Case Studies Requirement Gathering Use Case Modeling Domain Modeling / Business Modeling Activity Diagram 3/15/2018 3

Case Study 1: The Restaurant n n Example developed in the Practical Object. Oriented Case Study 1: The Restaurant n n Example developed in the Practical Object. Oriented Design With UML by Mark Priestley, chapter 4. Support the day-to-day operations of restaurant by improving the processes of: q q n Making Reservations Allocating Tables Current System is based on manual booking system: q 3/15/2018 Hand-written forms in large folder. 4

Case Study 1: The Restaurant § Current system uses manual booking sheets. 3/15/2018 5 Case Study 1: The Restaurant § Current system uses manual booking sheets. 3/15/2018 5

Case Study 1: The Restaurant n Three sittings (slots) in an evening q n Case Study 1: The Restaurant n Three sittings (slots) in an evening q n Each Booking records: q n Booking can span more than one slot Contact Name and Phone Number Annotation made for various events: q q q 3/15/2018 Arrival of customer (Cross out record) Table switch (Arrow to new table) Cancellation Time to vacate “Walk-In” Customer 6

Case Study 1: Restaurant n Problems with the manual systems: q q n Slow Case Study 1: Restaurant n Problems with the manual systems: q q n Slow Confusing and difficult to read No backup copies Hard to get useful management data Develop an automated computerized version. 3/15/2018 7

Case Study 2: The Monopoly Game n n Chosen because of its familiarity. A Case Study 2: The Monopoly Game n n Chosen because of its familiarity. A game played almost in every country. Developed in the Applying UML and Patterns by Craig Larman, Chapter 3. The software version will run as simulation: q q 3/15/2018 User starts the simulation by indicating the number of simulated players. All turns are simulated with result (trace) printed. 8

Case Study 3: The Bicycle Renting n n Adopts a use-case driven object-oriented approach Case Study 3: The Bicycle Renting n n Adopts a use-case driven object-oriented approach to develop a system to support the process of bicycle renting in a kiosk at East Coast Park, Singapore. Developed in the Software Engineering: An objectoriented approach by Bimlesh Wadhwa, Stefan Andrei, Soo Yuen Jien, 2007, Mc. Graw Hill. 3/15/2018 9

Where are we now? n Requirement q Analysis n Design Implement Requirement Gathering Understanding Where are we now? n Requirement q Analysis n Design Implement Requirement Gathering Understanding the requirements. Business Modeling q Understanding the problem domain. Test 3/15/2018 10

Requirement: Overview n n Early phase of the development. Inputs: q n informal specification. Requirement: Overview n n Early phase of the development. Inputs: q n informal specification. Activities: q q q 3/15/2018 create use case model. define use cases. create domain model. create glossary. create activity diagram. 11

Use Case View § § § Intended to provide a structured view of the Use Case View § § § Intended to provide a structured view of the system's functionality. Description of how users interact with the system. Supported by UML use case diagrams. Serves as the starting point for all subsequent development. Three important definitions: § § § 3/15/2018 Use Case Scenario Actor 12

Use Case and Scenarios § Use Case: § § The different tasks that users Use Case and Scenarios § Use Case: § § The different tasks that users can perform while interacting with the system. Scenarios: § Are particular instances of the use case: § § Alternative Course of Events: optional flow. § 3/15/2018 Basic Course of Events: normal flow. Exceptional Course of Events: erroneous flow. 13

Actor § Roles played by users when interacting with a system, e. g. : Actor § Roles played by users when interacting with a system, e. g. : § § Receptionist (makes bookings); Head waiter (assigns tables etc). Individual user may play one or more roles at different times. Often corresponds to certain level of access, e. g. , logging into Lamar website as Staff or Student. 3/15/2018 14

Use Case Diagram n n UML diagram to summarize the relationship between actors and Use Case Diagram n n UML diagram to summarize the relationship between actors and use cases. Diagram Element: Actor Communication Use Case <> Inherit (Actor Relationship) 3/15/2018 Constraints <> Use Case Dependency 15

Case Study 1: Use Cases n A preliminary list of use cases: 1 Record Case Study 1: Use Cases n A preliminary list of use cases: 1 Record new booking. 2 Cancel a booking. 3 Record customer arrival. 4 Transfer a customer from one table to another. 3/15/2018 16

Case Study 1: Use Case Diagram § Show use cases, actors and who does Case Study 1: Use Case Diagram § Show use cases, actors and who does what. System 3/15/2018 17

Use Cases Description § § A use case comprises all the possible interactions that Use Cases Description § § A use case comprises all the possible interactions that a user can have when performing a given task. Often a dialogue between system and user. These are described as courses of events, or scenarios. A full description of a use case includes: § § 3/15/2018 a basic course of events; a number of alternative and exceptional courses. 18

Basic Course of Events § § Describes what happens in the ‘normal’ case. For Basic Course of Events § § Describes what happens in the ‘normal’ case. For example, for ‘Record Booking’: Record Booking: Basic Course of Events § Receptionist enters date of requested reservation; § System displays bookings for that date; § There is a suitable available: Receptionist enters details (customer’s name, phone number, time of booking, number of covers, table number); § System records and displays new booking. 3/15/2018 19

Use Case Templates § § § UML does not define a standard format for Use Case Templates § § § UML does not define a standard format for use case descriptions. Various templates have been defined to structure descriptions. Essentially a list of subheadings such as: § § § 3/15/2018 Name Actors Courses of events 20

Other Use Case Description Template n This version emphasizes the exchange between user and Other Use Case Description Template n This version emphasizes the exchange between user and system, e. g. : Actor System 1. Receptionist enters date of requested reservation; 2. System displays bookings for that date. 3. there is a suitable available: Receptionist enters details (customer’s name, phone number, time of booking, number of covers, table number); 4. System records and displays new booking. 3/15/2018 21

User Interface Prototype n During the use case modeling activity, it is usually useful User Interface Prototype n During the use case modeling activity, it is usually useful to have a rough idea of the user interface, e. g. : 3/15/2018 22

Alternative Courses of Events § § Describe predicted alternative flows. For example, if no Alternative Courses of Events § § Describe predicted alternative flows. For example, if no table is available: Record Booking – No Table Available: Alternative Course of Event 1 2 3 3/15/2018 Receptionist enters date; System displays bookings; no table available: end of use case. 23

Exceptional Courses of Events § § Situations where a mistake has been made. E. Exceptional Courses of Events § § Situations where a mistake has been made. E. g. , allocate a booking to a small table: Record Booking – table too small: Exceptional course of events 1 receptionist enters date; 2 3 4 5 6 3/15/2018 system displays bookings; receptionist enters details; system asks for confirmation of oversize booking; if “no”, use case terminates with no booking made; if “yes”, booking recorded with warning flag. 24

Shared Functionality Different use cases can overlap. E. g. , ‘Record Arrival’: § § Shared Functionality Different use cases can overlap. E. g. , ‘Record Arrival’: § § Record Arrival: Basic Course of Events § § § head waiter enters date; system displays bookings; head waiter confirms arrival for booking; system records this and updates display. First two steps shared with ‘Record Booking’ (even though different actor). 3/15/2018 25

Use Case Inclusion Move shared functionality to a separate use case: § Display Bookings: Use Case Inclusion Move shared functionality to a separate use case: § Display Bookings: Basic Course of Events § user enters a date; § system displays bookings for that date. § Include this in other use cases, e. g. : Record Booking: Basic Course of Events (revised) § receptionist performs Display Bookings; § receptionist enters details; § system records and displays new booking. 3/15/2018 26

The <<include>> Dependency § UML shows inclusion as a dependency between use cases, labelled The <> Dependency § UML shows inclusion as a dependency between use cases, labelled with the stereotype <> on the dashed arrow: System 3/15/2018 27

Case Study 1: Use Case Diagram (Revised) Display booking System 3/15/2018 28 Case Study 1: Use Case Diagram (Revised) Display booking System 3/15/2018 28

Actor Generalization § The last diagram shows that the Receptionist can performs the Display Actor Generalization § The last diagram shows that the Receptionist can performs the Display bookings use case independently from the Record Booking use case. § Head Waiters can also performs Display bookings use case. § Introduce a more general actor Staff to show what the other two actors have in common. § The initial actors are specializations of the general actor. 3/15/2018 29

Actor Generalization Notation System 3/15/2018 30 Actor Generalization Notation System 3/15/2018 30

Use Case Extension § Recording a walk-in can be described as an exceptional course Use Case Extension § Recording a walk-in can be described as an exceptional course of events: § § It could also be a separate use case: § § someone arrives but there’s no booking recorded. a customer arrives and asks if there's a free table. Then, it can extend ‘Record Arrival’: § 3/15/2018 even without a booking, the customer stays to eat. 31

Use Case Extension Record Walk-in: Basic Course of Events: 1 Head waiter performs Display Use Case Extension Record Walk-in: Basic Course of Events: 1 Head waiter performs Display Bookings use case; 2 Head waiter enters details (time, number of covers and the table allocated to the customer); 3 System records and displays new booking. § § § Very similar to Record Arrival use case. Can we simplify? <> dependency is inappropriate. (why? ) Record Walk-in is performed in some cases of Record Arrival, when there is no booking for the customer. 3/15/2018 32

The <<extend>> Dependency § § § Use case extension is shown with a <<extend>> The <> Dependency § § § Use case extension is shown with a <> dependency. Record walk-in optionally extends the functionality of Record arrival. States the constraint (condition) which causes the branch off. No Prior Booking System 3/15/2018 33

Case Study 1: Complete Use Case Diagram System 3/15/2018 34 Case Study 1: Complete Use Case Diagram System 3/15/2018 34

Guidelines § Use case: § § § Should cover full sequence of steps from Guidelines § Use case: § § § Should cover full sequence of steps from the beginning of a task until the end. Should describe user’s interaction with the system. Should not describe actual computations. Should be as independent as possible from any particular user interface design. Should only include actions in which the actor interacts with the computer. Use case diagram should be used to supplement the use case description, not as the main artifact. § 3/15/2018 35

Use Cases: Strengths n Simple and Familiar q q n n Can be understood Use Cases: Strengths n Simple and Familiar q q n n Can be understood easily by untrained personnel, e. g. , the customer. Involve the customer early in the development. Emphasize the user goals and perspective. Scale in term of sophistication and formality. 3/15/2018 36

Use Cases: Problems n n Care must be taken to ensure the use cases Use Cases: Problems n n Care must be taken to ensure the use cases are complete and unambiguous. Only actor initiated activities are recorded. Software requirement derived from use cases often mimics the manual system too closely. Preventing any innovative or more efficient way to be developed. 3/15/2018 37

Domain Modelling § Using UML diagram to construct a model of the real-world system: Domain Modelling § Using UML diagram to construct a model of the real-world system: § § § Understand the problem domain. Model recorded as a simplified class diagram. Seamless development: § § 3/15/2018 The same notation is used for analysis and design. The design can evolve from the initial domain model. 38

Domain Model Notation n A subset of class diagram model elements are used. Class Domain Model Notation n A subset of class diagram model elements are used. Class Name Attributes Name Multiplicity Association Class Generalization 3/15/2018 Constraints 39

Domain Model Notation § § § Classes represent real-world entities. Attributes represent the data Domain Model Notation § § § Classes represent real-world entities. Attributes represent the data held about entities. Associations represent relationships between the entities. Generalization can be used to simplify the structure of the model. Constraints can be used to indicate conditions. 3/15/2018 40

Case Study 1: Customers and Reservations § Basic business fact: customers make reservations. 3/15/2018 Case Study 1: Customers and Reservations § Basic business fact: customers make reservations. 3/15/2018 41

Defining a Relationship § Give a name to the relationship: § use a verb Defining a Relationship § Give a name to the relationship: § use a verb so that the relationship can be read as a sentence: § § A customer can make many reservations. How many people make a reservation? § § § 3/15/2018 one principal contact whose details are held; that principal contact can make more than one reservation (e. g. , by postponing the time); the expected number of diners can be modelled as an attribute of the reservation. 42

Case Study 1: Tables and Reservation § § Is table number an attribute of Case Study 1: Tables and Reservation § § Is table number an attribute of ‘Reservation’? Better modelled as a separate class: § § 3/15/2018 tables exist even if there are no reservations; other attributes of tables, e. g. , size, can be stored. 43

Use of Constraints § Not all domain properties can be shown graphically: § § Use of Constraints § Not all domain properties can be shown graphically: § § e. g. , it should be impossible to double-book a table. Constraints add information to models: § 3/15/2018 written in a note connected to the model element being constrained. 44

Use of Generalization § A superclass can be used to show the properties shared Use of Generalization § A superclass can be used to show the properties shared by different types of booking. 3/15/2018 45

Correctness § How do we know when a domain model is complete? § § Correctness § How do we know when a domain model is complete? § § § we don't: there are lots of plausible models in most cases. Domain modelling is not an end in itself, but a guide to further development. Realizing use cases tests the domain model, and will usually lead to refinements. 3/15/2018 46

Supplementary Documents n Common Supplementary Documentation: q q n Glossary. Activity Diagram. A mini Supplementary Documents n Common Supplementary Documentation: q q n Glossary. Activity Diagram. A mini dictionary that captures concepts and vocabulary relevant in the problem domain. Avoids misunderstanding and facilitate communication. Activity Diagram q UML diagram that describes activities. 3/15/2018 47

Case Study 1: Partial Glossary § § § Booking: an assignment of diners to Case Study 1: Partial Glossary § § § Booking: an assignment of diners to a table. Covers: the number of diners for a booking. Customer: a person who makes a reservation. Reservation: a booking made in advance. Walk-in: a booking that is not made in advance. 3/15/2018 48

Activity Diagram n Similar to flow chart that describes sequence of activities. n Useful Activity Diagram n Similar to flow chart that describes sequence of activities. n Useful in: q Business Modelling (business workflow). q Use Cases (interrelation and interaction). q Design (algorithm, complex sequence etc). n Often associated with several classes. n One of the strengths of activity diagrams is the representation of concurrent activities. 3/15/2018 49

Activity Diagram n Diagram Elements: Activity Initial Node Transition Decision 3/15/2018 Activity End Node Activity Diagram n Diagram Elements: Activity Initial Node Transition Decision 3/15/2018 Activity End Node Fork Join Action Rendezvous 50

Activity Diagram n Action: q q q n Transition: q n Fundamental block in Activity Diagram n Action: q q q n Transition: q n Fundamental block in an activity diagram. Represents a unit of work (something is done). Automatic transition upon completion. Represents the control flow: it is simply a movement between actions. Initial and End Node: q 3/15/2018 Show the beginning and ending points in an activity diagram. 51

Case Study 1: Activity Diagram n Documenting the sequence when customer arrives. n Note Case Study 1: Activity Diagram n Documenting the sequence when customer arrives. n Note the interrelation of Record Arrival and Record Walk-In. Display Booking Enter Information Record Walk-In 3/15/2018 [No Booking] [Booking Exist] Confirm Arrival 52

Concurrent Actions n n Independent actions which can be carried out at the same Concurrent Actions n n Independent actions which can be carried out at the same time (in parallel). Shown using forks, joins and rendezvous: q Fork: n n q One incoming transition and multiple outgoing transitions. Execution splits into multiple concurrent threads. Rendezvous: n n 3/15/2018 Multiple incoming and multiple outgoing transitions. All incoming transitions must occur before the outgoing transitions. 53

Representing Concurrency n Join: q q 3/15/2018 Multiple incoming transitions and one outgoing transition. Representing Concurrency n Join: q q 3/15/2018 Multiple incoming transitions and one outgoing transition. The outgoing transition will be taken when all incoming transitions have occurred. 54

Activity Diagram: Another Example Receive course registration request n Use Cases: q Check prerequisites Activity Diagram: Another Example Receive course registration request n Use Cases: q Check prerequisites [not ok] Check special permission [ok] Verify course not full [ok] [not ok] n Register student: q [ok] q [not ok] Submit registration request. q Verify prerequisites. Verify course enrolment. Verify special cases. Complete registration 3/15/2018 55

Swimlanes n Activity diagrams are most often associated with several classes. q q 3/15/2018 Swimlanes n Activity diagrams are most often associated with several classes. q q 3/15/2018 The partition of activities among the existing classes can be explicitly shown using swimlanes. Further clarify where an action takes place. 56

Swimlanes: Example Course Student Receive course registration request Action taken by Student Check prerequisites Swimlanes: Example Course Student Receive course registration request Action taken by Student Check prerequisites [not ok] Check special permission [ok] Verify course not full [ok] [not ok] [ok] Action taken by Course [not ok] Complete registration 3/15/2018 57

Where are we now? n Requirement Analysis Typical Artifacts: q q Requirement Specification. Use Where are we now? n Requirement Analysis Typical Artifacts: q q Requirement Specification. Use Cases: n n Design n n Implement q Use Case Description. Use Case Diagrams. Activity Diagrams. Glossary. Domain Model. Test 3/15/2018 58

Summary n n n Introduction to Case Studies Requirement Gathering Use Case Modeling Domain Summary n n n Introduction to Case Studies Requirement Gathering Use Case Modeling Domain Modeling / Business Modeling Activity Diagram 3/15/2018 59

Reading suggestions n From [Wadhwa, Andrei, Soo; 2007] q n From [Priestley; 2004] q Reading suggestions n From [Wadhwa, Andrei, Soo; 2007] q n From [Priestley; 2004] q q n Chapter 4, sections 4. 2 to 4. 5 Exercises 4. 1 -4. 7 From [Larman; 2005] q n Chapter 3 Chapters 1, 6 From [Stevens, Pooley; 1999] q 3/15/2018 Chapter 11 60

Coming up next n Analysis: q q n [Priestley; 2004], Chapter 5 [Wadhwa, Andrei, Coming up next n Analysis: q q n [Priestley; 2004], Chapter 5 [Wadhwa, Andrei, Soo; 2007], Chapter 3 UML Class and Object Diagrams: q q 3/15/2018 [Priestley; 2004], Chapter 8 [Wadhwa, Andrei, Soo; 2007], Chapter 4 61

Thank you for your attention! Questions? 3/15/2018 62 Thank you for your attention! Questions? 3/15/2018 62