Top Banner
1 CS 106, Winter 2009 Class 2, Section 4 Slides by: Dr. Cynthia A. Brown, [email protected] Instructor section 4: Dr. Herbert G. Mayer, [email protected]
41

CS 106, Winter 2009 Class 2, Section 4

Feb 15, 2016

Download

Documents

DYAN

CS 106, Winter 2009 Class 2, Section 4. Slides by: Dr. Cynthia A. Brown, [email protected] Instructor section 4: Dr. Herbert G. Mayer, [email protected]. 1. The Problem-Solving Process. IMAGINE. SHOW. LOOK. SEE. Six Frameworks for Showing. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CS 106, Winter 2009 Class 2, Section 4

1

CS 106, Winter 2009Class 2, Section 4

Slides by: Dr. Cynthia A. Brown, [email protected] section 4: Dr. Herbert G. Mayer, [email protected]

Page 2: CS 106, Winter 2009 Class 2, Section 4

2

The Problem-Solving Process

SHOW

IMAGINE

LOOK SEE

Page 3: CS 106, Winter 2009 Class 2, Section 4

3

Six Frameworks for Showing

• Who/what: qualitative representation: portrait• How much: quantitative representation: chart• Where: position in space: map• When: position in time: timeline• How: cause and effect: flowchart• Why: deduction and prediction: multi-variable chart• Combination Frameworks– Time series chart (how much and when)– Value chain (timeline/flowchart: when/how)

Page 4: CS 106, Winter 2009 Class 2, Section 4

4

SQVID

Each framework can take multiple forms based on the situation.

• S: simple vs. elaborate• Q: quality vs. quantity• V: vision vs. execution• I: individual vs. comparison• D: change vs. as-is(see the “codex” on BN pg. 141)

Page 5: CS 106, Winter 2009 Class 2, Section 4

5

Example Using Timelines

• We want to make a master plan showing team leaders when each step of a complex process they are directing and coordinating will take place

• When -> timeline• Since we need to convey a large amount of

precise information, the timeline will be elaborate, quantitative, and execution-oriented (Gantt Chart)

Page 6: CS 106, Winter 2009 Class 2, Section 4

6

Gantt Chart Example

Page 7: CS 106, Winter 2009 Class 2, Section 4

7

GANTT with Dependencies

Page 8: CS 106, Winter 2009 Class 2, Section 4

8

Baseline GANTT(shows comparison, change)

Page 9: CS 106, Winter 2009 Class 2, Section 4

9

How Many/How Much

• Bar charts are often used • Pie charts are another option (controversial)• There are plenty of interesting and clever

variations… such as the word usage chart (next slide)

Page 10: CS 106, Winter 2009 Class 2, Section 4

10

Variation on Bar ChartWord Usage in McCain Speech

Page 11: CS 106, Winter 2009 Class 2, Section 4

11

Where: Maps Can Be Conceptual

• A map is an obvious choice for looking at geographic distribution or position

• But we can also use conceptual maps to show the relationships among ideas or concepts

Page 12: CS 106, Winter 2009 Class 2, Section 4

12

CS Curriculum Map

Page 13: CS 106, Winter 2009 Class 2, Section 4

13

Our Goal: Defining a Process

• We will specify a “what”: a process we want to define.

• Then we will describe “how” to complete the process for the desired result.

• Let’s start by looking at some everyday descriptions of processes.

• Writing a clear and complete description is not as easy as it might seem.

Page 14: CS 106, Winter 2009 Class 2, Section 4

14

Example: Recipe

What we need(partial list)

How to proceed

Page 15: CS 106, Winter 2009 Class 2, Section 4

15

Observations

• The recipe assumes we have equipment like an oven and a muffin pan, grease for the pan, bowls and beaters, etc.

• It assumes a lot of knowledge: What does “alternately” mean? What do you do if the butter is hard? And so on.

Page 16: CS 106, Winter 2009 Class 2, Section 4

16

This set of instructionsis crying for a picture!

It also make a lot ofassumptions. What does “edgeband” mean? How do you attach things?

What you need

Page 17: CS 106, Winter 2009 Class 2, Section 4

17

Defining a Process Clearly

• Start with what we want to have happen: inputs, outputs, interface (picture)

• Write use cases to make sure we have covered all the possibilities

• Define tests to determine if our process works properly, once it is defined

• Figure out and specify howit should work using a flowchart

Page 18: CS 106, Winter 2009 Class 2, Section 4

18

Example: Candy Machine

• We’re going to define the process of getting candy from a candy machine.

• We start with WHAT: what is supposed to happen, precisely? What items/people are involved?

• We’ll use a picture to help us out.

Page 19: CS 106, Winter 2009 Class 2, Section 4

19

BREAK

10 min

Page 20: CS 106, Winter 2009 Class 2, Section 4

20

Too simple…

Page 21: CS 106, Winter 2009 Class 2, Section 4

21

More like it...

Page 22: CS 106, Winter 2009 Class 2, Section 4

22

Initial Picture (What)

$$¢¢

A

B

C

A B C

customer money

candy for saleselection buttonsmoney input slot

coin return button

money return bin

candy pickup bin

Page 23: CS 106, Winter 2009 Class 2, Section 4

23

Use Cases

• A use case is a scenario that runs through the process

• It helps us visualize the process and refine our understanding

• Usually there is at least one “normal” version of the process. We start with that and then bring in unusual or exceptional versions.

Page 24: CS 106, Winter 2009 Class 2, Section 4

24

Normal Use Case

• Customer puts money in money input slot• Customer presses a selection button• Candy from that selection goes into the candy

pickup bin• Customer takes the candy

• This makes a lot of assumptions and is missing some things

Page 25: CS 106, Winter 2009 Class 2, Section 4

25

Problems

• What if the customer put in too little money, or too much?

• Where did the money go after the customer paid?

• What if all the candy is gone?

• We can do some additional use cases for these, but first let’s clean up this one

Page 26: CS 106, Winter 2009 Class 2, Section 4

26

Normal Use Case, Take 2

• Customer puts exactly the right amount of money in the money input slot.– How does the machine know how much money was put

in? It needs a money counter. • Customer presses the selection button– How does the machine know it’s the right amount of

money? It needs a price list.• Candy from that selection goes into the candy pickup

bin• Customer takes the candy

Page 27: CS 106, Winter 2009 Class 2, Section 4

27

Picture, Take 2

$$¢¢

A

B

C

A B C

customer money

candy for saleselection buttonsmoney input slot

coin return button

money return bin

candy pickup bin

Money counter

Price list

Page 28: CS 106, Winter 2009 Class 2, Section 4

28

Normal Use Case, Take 3

• Customer puts money in the money input slot• Customer pushes a selection button• The money put in is exactly the right amount

for that selection• Candy from the selection goes into the candy

pickup bin• The customer takes the candy

Page 29: CS 106, Winter 2009 Class 2, Section 4

29

Principles

• The use case covers exactly one scenario.• So normally there are no conditionals (ifs)• The use case is testable.

Page 30: CS 106, Winter 2009 Class 2, Section 4

30

Testing the normal use case

• How do you test this case? Follow the script:– Put in money– Push a selection that costs the amount you put in– See if you got the candy

• Can you think of a possible problem?

Page 31: CS 106, Winter 2009 Class 2, Section 4

31

Problem

• What if the machine is out of candy for that selection? What should happen? We need to add to the normal use case description, that the machine has enough candy. Out of candy is another case, not the normal one.

Page 32: CS 106, Winter 2009 Class 2, Section 4

32

Second use case

• The customer puts money in the money input slot• The customer pushes a selection button• The amount of money put in is bigger than the

price of the selection• The machine has the kind of candy selected• Candy from the selection goes into the candy

pickup bin• Change goes into the coin return bin

Page 33: CS 106, Winter 2009 Class 2, Section 4

33

Questions on second use case

• Where does the machine get the change?• What if it does not have enough money, or the

right coins, to give exact change? What should happen? (This would be another use case)

• How does the machine know how much change to give? (Looks like it needs another component)

Page 34: CS 106, Winter 2009 Class 2, Section 4

34

Picture, Take 3

$$¢¢

A

B

C

A B C

customer money

candy for saleselection buttonsmoney input slot

coin return button

money return bin

candy pickup bin

Money counter/change computer

Price list

Money bin

Page 35: CS 106, Winter 2009 Class 2, Section 4

35

Second use case, Take 2

• The customer puts money in the money input slot• The customer pushes a selection button• The amount of money put in is bigger than the price of

the selection• The machine has the kind of candy selected• Candy from the selection goes into the candy pickup bin• The machine has enough of the right kind of money to

make change• Change goes into the coin return bin

Page 36: CS 106, Winter 2009 Class 2, Section 4

36

Test for the second use case

• Put money in the machine• Choose a selection that costs less than the

amount you put in• Make sure the machine has the right kind of

money to make change (may not be possible…)

• You should get the candy and the correct change

Page 37: CS 106, Winter 2009 Class 2, Section 4

37

Third case

• The customer puts money in the machine• The customer pushes a selection button• The selection costs more than what the

customer put in

• What should happen? How would you test it?

Page 38: CS 106, Winter 2009 Class 2, Section 4

38

Fourth Case

• The customer puts in money• The customer pushes a selection button• The selection costs less than what the customer put

in• The machine does not have enough change or the

right kind of change

• What should happen? How would you test this? (You might need to make the machine run out of money.)

Page 39: CS 106, Winter 2009 Class 2, Section 4

39

What other cases can you think of?

• For each one, you need to specify a script• You also need to determine a test to make

sure the machine does what it is supposed to in that situation

Page 40: CS 106, Winter 2009 Class 2, Section 4

40

What, not How

• Notice that the use cases say what should happen, not how the machine decides what to do

• Each separate scenario has its own case• Each case has one or more tests that verify

the behavior of the machine

Page 41: CS 106, Winter 2009 Class 2, Section 4

41

Your Assignment

• Develop a set of use cases for an automated parking meter like the ones the city uses

• Describe all the elements of the parking meter (picture is optional)

• Do as many use cases as you can think of; try to cover all the possibilities

• Include a test for each use case• Upload the final document (pdf file) to

Blackboard