Presentation is loading. Please wait.

Presentation is loading. Please wait.

Slide 11.1 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. CHAPTER 11 THE ANALYSIS WORKFLOW (Derived from Stephen R. Schach’s.

Similar presentations


Presentation on theme: "Slide 11.1 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. CHAPTER 11 THE ANALYSIS WORKFLOW (Derived from Stephen R. Schach’s."— Presentation transcript:

1 Slide 11.1 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. CHAPTER 11 THE ANALYSIS WORKFLOW (Derived from Stephen R. Schach’s )

2 Slide 11.2 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Overview l The specification document l Informal specifications l Correctness proof mini case study redux l The analysis workflow l Extracting the entity classes l The elevator problem l Functional modeling: The elevator problem case study l Entity class modeling: The elevator problem case study

3 Slide 11.3 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Overview (contd) l Dynamic modeling: The elevator problem case study l The test workflow: The elevator problem case study l Extracting the boundary and control classes l The specification document in the Unified Process l More on actors and use cases l CASE tools for the analysis workflow l Challenges of the analysis workflow

4 Slide 11.4 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. The Specification Document Must Be l Informal enough for the client – The client is generally not a computer specialist l Formal enough for the developers – It is the sole source of information for drawing up the design l These two requirements are mutually contradictory

5 Slide 11.5 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.1 The Specification Document l The specification document is a contract between the client and the developers l Typical constraints – Deadline – Parallel running – Portability – Reliability – Rapid response time l For real-time software – Hard real-time constraints must be satisfied

6 Slide 11.6 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Specification Document (contd) l Acceptance criteria – It is vital to spell out a series of tests l If the product passes the tests, it is deemed have satisfied its specifications l Some acceptance criteria are restatements of constraints

7 Slide 11.7 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Solution Strategy l A general approach to building the product l Find strategies without worrying about constraints – Then modify the strategies in the light of the constraints, if necessary l Keep a written record of all discarded strategies, and why they were discarded – To protect the analysis team – To prevent unwise new “solutions” during postdelivery maintenance

8 Slide 11.8 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.2 Informal Specifications l Informal specifications are written in a natural language – Examples: English, Mandarin, Kiswahili, Hindi l Example “If the sales for the current month are below the target sales, then a report is to be printed, unless the difference between target sales and actual sales is less than half of the difference between target sales and actual sales in the previous month, or if the difference between target sales and actual sales for the current month is under 5%”

9 Slide 11.9 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. The Meaning of This Specification l The sales target for January was $100,000, but actual sales were only $64,000 (36% below target) – Print the report l The sales target for February was $120,000, the actual sales were only $100,000 (16.7% below target) – The percentage difference for February (16.7%) is less than half of the previous month’s percentage difference (36%), so do not print the report

10 Slide 11.10 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. The Meaning of This Specification (contd) l The sales target for March was $100,000, the actual sales were $98,000 (2% below target) – The percentage difference is under 5%, so do not print the report

11 Slide 11.11 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. But the Specifications Do Not Say This l “[D]ifference between target sales and actual sales” – There is no mention of percentage difference in the specifications l The difference in January was $36,000, the difference in February was $20,000 – Not less than half of $36,000, so the report is printed l “[D]ifference … [of] 5%” – Again, no mention of percentage

12 Slide 11.12 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. But the Specifications Do Not Say This (contd) l Ambiguity—should the last clause read “percentage difference … [of] 5%” or “difference … [of] $5,000” or something else entirely? l The style is poor – The specifications should state when the report should be printed … – … Rather than when it should not be printed

13 Slide 11.13 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Informal Specifications (contd) l Claim – This cannot arise with professional specifications writers l Refutation – Text processing case study

14 Slide 11.14 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.3 Correctness Proof Case Study l Naur text-processing problem Given a text consisting of words separated by blank or by newline characters, convert it to line-by-line form in accordance with the following rules: (1) Line breaks must be made only where the given text contains a blank or newline ; (2)Each line is filled as far as possible, as long as (3)No line will contain more than maxpos characters

15 Slide 11.15 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Text-Processing Episode l 1969 — Naur Paper – Naur constructed a procedure (25 lines of Algol 60), and informally proved its correctness l 1970 — Reviewer in Computing Reviews – The first word of the first line is preceded by a blank unless the first word is exactly maxpos characters long l 1971 — London found 3 more faults – Including: The procedure does not terminate unless a word longer than maxpos characters is encountered l 1975 — Goodenough and Gerhart found 3 further faults – Including: The last word will not be output unless it is followed by a blank or newline l Goodenough and Gerhart then produced a new set of specifications, about four times longer than Naur’s

16 Slide 11.16 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Text-Processing Episode (cont) l Goodenough&Gerhart then produced a new set of specifications, about four times longer than Naur’s – Goodenough and Gerhart’s specifications » Were constructed with the greatest of care » Were constructed to correct Naur’s specifications » Went through two versions, carefully refereed » Were written by experts in specifications, » With as much time as they needed, » For a product about 30 lines long l 1985 — Meyer detected 12 faults in Goodenough and Gerhart’s specifications l So, what chance do we have of writing fault-free specifications for a real product?

17 Slide 11.17 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Text-Processing Episode (cont) l 1989 — Schach found a fault in Meyer’s specifications – Item (2) of Naur’s original requirement (“each line is filled as far as possible”) is not satisfied l Conclusion about Informal Specifications – Natural language is not a good way to specify a product

18 Slide 11.18 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Object-Oriented Analysis l OOA is a semiformal analysis technique for the object-oriented paradigm – There are over 60 equivalent techniques – Today, the Unified Process is the only viable alternative l During this workflow – The classes are extracted l Remark – The Unified Process assumes knowledge of class extraction

19 Slide 11.19 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.4 The Analysis Workflow l The analysis workflow has two aims – Obtain a deeper understanding of the requirements – Describe them in a way that will result in a maintainable design and implementation

20 Slide 11.20 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. The Analysis Workflow (contd) l There are three types of classes: l Entity classes l Boundary classes l Control classes

21 Slide 11.21 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. The Analysis Workflow (contd) l Entity class – Models long-lived information – Examples: » Account Class » Investment Class l Boundary class – Models interaction between product and environment – A boundary class generally associated with input/output – Examples: » Investments Report Class » Mortgages Report Class l Control class – Models complex computations and algorithms – Example: » Estimate Funds for Week Class

22 Slide 11.22 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. UML Notation for These Three Class Types l Stereotypes (extensions of UML) Figure 11.1

23 Slide 11.23 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.5 Extracting the Entity Classes l Perform the following three steps incrementally and iteratively – Functional modeling » Present scenarios of all the use cases (a scenario is an instance of a use case) – Class modeling » Determine the entity classes and their attributes » Determine the interrelationships and interactions between the entity classes » Present this information in the form of a class diagram – Dynamic modeling » Determine the operations performed by or to each entity class » Present this information in the form of a statechart

24 Slide 11.24 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.6 The Elevator Problem A product is to be installed to control n elevators in a building with m floors. The problem concerns the logic required to move elevators between floors according to the following constraints: 1.Each elevator has a set of m buttons, one for each floor. These illuminate when pressed and cause the elevator to visit the corresponding floor. The illumination is canceled when the corresponding floor is visited by the elevator 2.Each floor, except the first and the top floor, has two buttons, one to request an up-elevator, one to request a down-elevator. These buttons illuminate when pressed. The illumination is canceled when an elevator visits the floor, then moves in the desired direction 3.If an elevator has no requests, it remains at its current floor with its doors closed

25 Slide 11.25 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.7 Functional Modeling: The Elevator Problem Case Study l A use case describes the interaction between – The product, and – The actors (external users)

26 Slide 11.26 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Use Cases l For the elevator problem, there are only two possible use cases – Press an Elevator Button, and – Press a Floor Button Figure 11.2

27 Slide 11.27 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Scenarios l A use case provides a generic description of the overall functionality l A scenario is an instance of a use case l Sufficient scenarios need to be studied to get a comprehensive insight into the target product being modeled

28 Slide 11.28 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Normal Scenario: Elevator Problem Figure 11.3

29 Slide 11.29 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Exception Scenario: Elevator Problem Figure 11.4

30 Slide 11.30 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.8 Entity Class Modeling : The Elevator Problem Case Study l Extract classes and their attributes – Represent them using a UML diagram l One alternative: Deduce the classes from use cases and their scenarios – Possible danger: Often there are many scenarios, and hence – Too many candidate classes l Other alternatives: – CRC cards (if you have domain knowledge) – Noun extraction

31 Slide 11.31 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.8.1 Noun Extraction l A two-stage process l Stage 1. Concise problem definition – Describe the software product in single paragraph – Buttons in elevators and on the floors control the movement of n elevators in a building with m floors. Buttons illuminate when pressed to request the elevator to stop at a specific floor; the illumination is canceled when the request has been satisfied. When an elevator has no requests, it remains at its current floor with its doors closed

32 Slide 11.32 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Noun Extraction (contd) l Stage 2. Identify the nouns – Identify the nouns in the informal strategy – Buttons in elevators and on the floors control the movement of n elevators in a building with m floors. Buttons illuminate when pressed to request the elevator to stop at a specific floor; the illumination is canceled when the request has been satisfied. When an elevator has no requests, it remains at its current floor with its doors closed l Use the nouns as candidate classes

33 Slide 11.33 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Noun Extraction (contd) l Nouns – button, elevator, floor, movement, building, illumination, request, door – floor, building, door are outside the problem boundary — exclude – movement, illumination, request are abstract nouns — exclude (they may become attributes) l Candidate classes: – Elevator Class and Button Class l Subclasses: – Elevator Button Class and Floor Button Class

34 Slide 11.34 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. First Iteration of Class Diagram l Problem – Buttons do not communicate directly with elevators – We need an additional class: Elevator Controller Class Figure 11.5

35 Slide 11.35 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Second Iteration of Class Diagram l All relationships are now 1-to-n – This makes design and implementation easier Figure 11.6

36 Slide 11.36 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.8.2 CRC Cards l Used since 1989 for OOA l For each class, fill in a card showing – Name of Class – Functionality (Responsibility) – List of classes it invokes (Collaboration) l Now CRC cards are automated (CASE tool component)

37 Slide 11.37 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l Strength – When acted out by team members, CRC cards are a powerful tool for highlighting missing or incorrect items l Weakness – If CRC cards are used to identify entity classes, domain expertise is needed

38 Slide 11.38 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.9 Dynamic Modeling: The Elevator Problem Case Study l Produce a UML statechart l State, event, and predicate are distributed over the statechart Figure 11.7

39 Slide 11.39 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Dynamic Modeling: Elevator Problem (contd) l This UML statechart is equivalent to the state transition diagram of Figures 11.15 through 11.17 l This is shown by considering specific scenarios l In fact, a statechart is constructed by modeling the events of the scenarios

40 Slide 11.40 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.10 The Test Workflow: Elevator Problem l CRC cards are an excellent testing technique Figure 11.8

41 Slide 11.41 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards l Consider responsibility – 1.Turn on elevator button l This is totally inappropriate for the object-oriented paradigm – Responsibility-driven design has been ignored – Information hiding has been ignored l Responsibility 1.Turn on elevator button should be 1.Send message to Elevator Button Class to turn itself on

42 Slide 11.42 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l Also, a class has been overlooked l The elevator doors have a state that changes during execution (class characteristic) – Add class Elevator Doors Class – Safety considerations l Modify the CRC card

43 Slide 11.43 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Second Iteration of the CRC Card Figure 11.9

44 Slide 11.44 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. CRC Cards (contd) l Having modified the class diagram, reconsider the – Use-case diagram (no change) – Class diagram (see the next slide) – Statecharts – Scenarios (see the slide after the next slide)

45 Slide 11.45 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Third Iteration of Class Diagram Figure 11.10

46 Slide 11.46 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Second Iteration of the Normal Scenario: Figure 11.11

47 Slide 11.47 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. The Analysis Workflow: Elevator Problem (contd) l The analysis workflow is now fine l We should rather say: – The analysis workflow is fine for now l We may need to return to the analysis workflow during the design workflow

48 Slide 11.48 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.18.1 Estimate Funds Available for Week Use Case l Use case Figure 11.29

49 Slide 11.49 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Description of use case Figure 11.30

50 Slide 11.50 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Class diagram (classes that enter into the use case) Figure 11.31

51 Slide 11.51 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Scenario (one possible instance of the use case) Figure 11.32

52 Slide 11.52 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l A working information system uses objects, not classes – Example: A specific mortgage cannot be represented by Mortgage Class but rather by an object, a specific instance of Mortgage Class Such an object is denoted by : Mortgage Class

53 Slide 11.53 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Communication diagram (of the realization of the scenario of the use case) Figure 11.33

54 Slide 11.54 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Estimate Funds Available for Week Use Case (contd) l Sequence diagram equivalent to the communication diagram (of the realization of the scenario of the use case) Figure 11.35

55 Slide 11.55 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Interaction Diagrams l The strength of a sequence diagram is that it shows the flow of messages and their order unambiguously – When transfer of information is the focus of attention, a sequence diagram is superior to a communication diagram l A communication diagram is similar to a class diagram – When the developers are concentrating on the classes, a communication diagram is more useful than the equivalent sequence diagram

56 Slide 11.56 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.11 Extracting the Boundary and Control Classes l Each – Input screen, – Output screen, and – Report is modeled by its own boundary class l Each nontrivial computation is modeled by a control class

57 Slide 11.57 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Manage an Asset Use Case (contd) Boundary class User Interface Class appears in all the realizations – The same screen will be used for all commands of the information system l Revised menu Figure 11.45

58 Slide 11.58 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. Manage an Asset Use Case (contd) l Corresponding textual interface Figure 11.46

59 Slide 11.59 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.22 The Specification Document in the Unified Process l The Unified Process is use-case driven – The use cases and the artifacts derived from them replace the traditional textual specification document l The client must be shown each use case and associated artifacts, both diagrammatic and textual – These UML diagrams convey to the client more information more accurately than the traditional specification document – The set of UML diagrams can also play the same contractual role as the traditional specification document

60 Slide 11.60 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. The Specification Document (contd) l A scenario is a specific execution sequence l The client can therefore appreciate how the product works equally well from – A use case together with its scenarios, or – A rapid prototype l The difference is – The use cases are successively refined, with more information added each time, whereas – The rapid prototype is discarded

61 Slide 11.61 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. The Specification Document (contd) l However, a rapid prototype of the user interface is required – Specimen screens and reports are needed (not a complete rapid prototype)

62 Slide 11.62 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.23 More on Actors and Use Cases l To find the actors, consider every role in which an individual can interact with the software product – Example: Applicants, Borrowers l Actors are not individuals – They are roles played by those individuals l Find all the different roles played by each user – From the list of roles, extract the actors l In the Unified Process – worker is used to denote a role played by an individual – So, Applicants and Borrowers are two different workers – The word “worker” usually refers to an employee l In this book, “role” is used in place of “worker”

63 Slide 11.63 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. More on Actors and Use Cases (contd) l Within a business context, finding the roles is easy – They are displayed within the use-case business model l To find the actors – Find the subset of the use-case business model that corresponds to the use-case model of the requirements l To find the actors (in more detail): – Construct the use-case business model – Consider only those parts of the business model that correspond to the proposed software product – The actors in this subset are the actors we seek l Within a business context, finding use cases is easy – For each role, there will be one or more use cases » Find the actors » The use cases then follow

64 Slide 11.64 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.24 CASE Tools for the Analysis Workflow l Diagrams play a major role in the analysis workflow l Diagrams often change – We need a diagramming tool – Many tools go further l All modern tools support UML – Commercial examples » IBM Rational Rose » Together – Open-source example » ArgoUML

65 Slide 11.65 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. 11.25 Challenges of the Analysis Workflow l Do not cross the boundary into the design workflow l Do not allocate methods to classes yet – Reallocating methods to classes during stepwise refinement is wasted effort


Download ppt "Slide 11.1 Copyright © 2008 by The McGraw-Hill Companies, Inc. All rights reserved. CHAPTER 11 THE ANALYSIS WORKFLOW (Derived from Stephen R. Schach’s."

Similar presentations


Ads by Google