Скачать презентацию Chapter 4 Dynamic Modeling and Analysis Part II Скачать презентацию Chapter 4 Dynamic Modeling and Analysis Part II

a492915d24c18b84be7d65d5ea6a479d.ppt

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

Chapter 4 Dynamic Modeling and Analysis (Part II) Object-Oriented Technology From Diagram to Code Chapter 4 Dynamic Modeling and Analysis (Part II) Object-Oriented Technology From Diagram to Code with Visual Paradigm for UML Curtis H. K. Tsang, Clarence S. W. Lau and Y. K. Leung Mc. Graw-Hill Education (Asia), 2005 1

Dynamic Analysis Techniques n n How can we transform from “what the system does” Dynamic Analysis Techniques n n How can we transform from “what the system does” (requirements) to “how the system is implemented”? (implementation) Use captures the external observable behaviors of the system. Need to know what objects are involved. Source of hints: n User interactions with the system n n Information retrieval/updated n n Entity objects Management of control flow and transaction n n Boundary objects control objects Data transformation, algorithm, etc. n other utility objects 2

Dynamic Analysis Techniques (cont’d) n Three steps for developing sequence diagram: n n n Dynamic Analysis Techniques (cont’d) n Three steps for developing sequence diagram: n n n Modeling External System Behaviors Modeling Communication among the Subsystems Developing Reusable Model/View/Control (MVC) Software Framework 3

Modeling External System Behaviors n n As the flow of events in the use Modeling External System Behaviors n n As the flow of events in the use case description only records the external behaviors of the system and identifies the user inputs and system responses from the flow of events of a scenario, it is a straightforward process to map the scenario to a system-level sequence diagram. In fact, this mapping process can be automated by a UML CASE tool. 4

Modeling Communication among the Subsystems n n Modeling and analyzing complex systems often involve Modeling Communication among the Subsystems n n Modeling and analyzing complex systems often involve many objects even for the realization of a single use case. To develop a detailed sequence diagram based on the systemlevel sequence diagram with sufficient information for implementation in one go generally requires a lot of effort. In order to manage the complexity associated with large and complex systems, it is advantageous to package objects into several subsystems. For example, an ATM system may be organized as a number of subsystems like the ATM, the bank consortium and the bank. Such an organization also reflects how the real-world hardware and software systems are configured, since the ATMs are connected to the bank consortium’s system which is in turn connected to the systems of individual banks. 5

Modeling Communication among the Subsystems (cont’d) 6 Modeling Communication among the Subsystems (cont’d) 6

Modeling Communication among the Subsystems (cont’d) 7 Modeling Communication among the Subsystems (cont’d) 7

Developing Reusable Model/View/Control (MVC) Software Framework n n At this point you will have Developing Reusable Model/View/Control (MVC) Software Framework n n At this point you will have developed the system-level sequence diagram and may have also developed a subsystem-level sequence diagram. We should then develop a detailed sequence diagram in three tiers, involving three types of objects: boundary, control and entity objects. 8

The Dynamic Modeling and Analysis Process n n n n Developing use case scenarios The Dynamic Modeling and Analysis Process n n n n Developing use case scenarios Developing system-level sequence diagrams Developing subsystem-level sequence diagrams (optional for simple system) Developing subsystem-level statechart diagrams (optional for simple system) Developing three-tier sequence diagrams Developing three-tier collaboration diagrams (optional) Developing a statechart diagram for each of these active (control) objects 9

The Dynamic Modeling and Analysis Process (cont’d) 10 The Dynamic Modeling and Analysis Process (cont’d) 10

The Dynamic Modeling and Analysis Process (cont’d) 11 The Dynamic Modeling and Analysis Process (cont’d) 11

The Dynamic Modeling and Analysis Process (cont’d) 12 The Dynamic Modeling and Analysis Process (cont’d) 12

Developing Use Case Scenarios n n Example – ATM System Flow of Events n Developing Use Case Scenarios n n Example – ATM System Flow of Events n n n n n User inserts card System prompts user to enter PIN User enters PIN System prompts user to select services User selects service - withdraw money System prompts user to enter withdrawal amount User enters withdrawal amount System displays “withdrawal successful” message, ejects card and dispenses money User collects card and money 13

Developing System-level Sequence Diagrams Flow of Events Actor Input System Response User inserts card Developing System-level Sequence Diagrams Flow of Events Actor Input System Response User inserts card System prompts user to enter PIN User enters PIN System prompts user to select services User selects “withdraw money” service System prompts user to enter the amount User enters the withdrawal amount System displays “withdrawal successful” message, ejects card and dispenses money User collects the card and money 14

Developing System-level Sequence Diagrams (cont’d) 15 Developing System-level Sequence Diagrams (cont’d) 15

Developing Subsystem-level Sequence Diagrams (optional) 16 Developing Subsystem-level Sequence Diagrams (optional) 16

Developing Subsystem-level Statechart diagram n n n With the subsystem-level sequence diagram created in Developing Subsystem-level Statechart diagram n n n With the subsystem-level sequence diagram created in Step 2, we can develop the subsystem-level statechart diagram for the scenario. Let us again use the ATM as an example. When the ATM is idle, it shows a main screen, for example, the welcome screen. If the user inserts a valid ATM card, it will display a “wait for input PIN” screen. 17

Developing Subsystem-level Statechart diagram (cont’d) 18 Developing Subsystem-level Statechart diagram (cont’d) 18

Developing Three-tier Sequence Diagrams n Identify Boundary, Control and Entity Objects n n n Developing Three-tier Sequence Diagrams n Identify Boundary, Control and Entity Objects n n n Message to and from the actor => boundary objects, e. g. insert card => card reader Information retrieval/ update => entity object, e. g. verify card => account Management of transaction => control objects, e. g. ATM controller 19

Developing Three-tier Sequence Diagrams (cont’d) 20 Developing Three-tier Sequence Diagrams (cont’d) 20

Developing Three-tier Sequence Diagrams (cont’d) 21 Developing Three-tier Sequence Diagrams (cont’d) 21

Developing Three-tier Sequence Diagrams (cont’d) 22 Developing Three-tier Sequence Diagrams (cont’d) 22

Developing Three-tier Sequence Diagrams (cont’d) 23 Developing Three-tier Sequence Diagrams (cont’d) 23

Developing Three-tier Collaboration Diagram 24 Developing Three-tier Collaboration Diagram 24

Developing Statechart Diagrams for Control Objects Statechart diagram of the Card Controller 25 Developing Statechart Diagrams for Control Objects Statechart diagram of the Card Controller 25

Tricks and Tips n Creating Cohesive and Self-sufficient Subsystems n n n Subsystems may Tricks and Tips n Creating Cohesive and Self-sufficient Subsystems n n n Subsystems may be considered as the next level of abstraction down from the entire system. Ideally, a subsystem should be a cohesive and independent part of the complex system, so as to bring out the benefits of portability, reusability and maintainability. A cohesive and independent subsystem is loosely coupled with other subsystems, and data coupling is the most loosely-coupled communication method between entities. 26

Tricks and Tips (cont’d) n Refining Class Diagrams Using MVC-level Scenario Analysis 27 Tricks and Tips (cont’d) n Refining Class Diagrams Using MVC-level Scenario Analysis 27

Tricks and Tips (cont’d) 28 Tricks and Tips (cont’d) 28

Tricks and Tips (cont’d) 29 Tricks and Tips (cont’d) 29

Tricks and Tips (cont’d) 30 Tricks and Tips (cont’d) 30

Tricks and Tips (cont’d) n Understanding System Reusability for Different Types of Objects Type Tricks and Tips (cont’d) n Understanding System Reusability for Different Types of Objects Type of Object Application Reusability Scope Object library General purpose Any application Entity Class Domain Specific Within the domain Control Class Application Specific Within the application Boundary Class Within the application Application Specific 31

Tricks and Tips (cont’d) n Do Not Create Giant Control Objects n n n Tricks and Tips (cont’d) n Do Not Create Giant Control Objects n n n the control sequence of messages in the scenario; information about the sessions in relation to the use case scenario, e. g. session ID, session status, etc. ; control logic of the run-time session, e. g. transaction management, error recovery, etc. 32

Tricks and Tips (cont’d) n Checking Consistency between Use Case and Sequence Diagrams 33 Tricks and Tips (cont’d) n Checking Consistency between Use Case and Sequence Diagrams 33

Tricks and Tips (cont’d) 34 Tricks and Tips (cont’d) 34

View Alignment between Sequence Diagram and State Diagram 35 View Alignment between Sequence Diagram and State Diagram 35

View Alignment between Sequence Diagram and State Diagram 36 View Alignment between Sequence Diagram and State Diagram 36