cs 520hconboy/class/2021spring/cs... · 2021. 3. 2. · cs 520 theory and prac2ce of so4ware...

51
CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 So#ware requirements March 2, 2021

Upload: others

Post on 27-Aug-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

CS520TheoryandPrac2ceofSo4wareEngineering

Spring2021

So#warerequirements

March2,2021

Page 2: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

In-classexercise1:AdvancedusesofGit

•  Due:WednesdayMarch3,2021,9AMEDT

•  Submission:– Couldeitherworkcollabora2velyasagroup(onyourownvideocall)

– Alterna2vely,couldworkindividuallyandwriteupasashareddocument(e.g.,overemail,GoogleDrive)

2

Page 3: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

Homework1:ThreeinaRowgameapp

•  Due:ThisSaturdayMarch6,9PMEDT•  Codereview:OOdesignprinciples,bestprogrammingprac2ces

•  Architecture:MVC(Model-View-Controller)paRern

•  Design:ObserverpaRern•  Officehours:ThisThursdaya4erlecture,ThisFriday9:30–10AM

3

Page 4: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

Today

•  RequirementsEngineering•  Specifica2on– Naturallanguage– FiniteStateAutomata(FSAs)– Specifica2onpaRerns

•  Finalproject

4

Page 5: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

RequirementsEngineering:Stakeholders

•  “individualsandorganiza2onswhoareac2velyinvolvedintheproject,orwhoseinterestsmaybeposi2velyornega2velyaffectedasaresultofprojectexecu2onorsuccessfulprojectcomple2on”

5

[ProjectManagementIns1tute(PMI®),1996]

Page 6: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

Example:ThreeinaRowgameapp(fromHomework1)

6

Page 7: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

Example:ThreeinaRowgameapp(fromHomework1)

•  Gameappplayers•  Gameappcompany:Developers,uppermanagement,usersupport,beta(user)testers

•  UIexperts:Humanfactors,HCI(Human-ComputerInterac2on)

•  Appstorecompany:Developersupport,Accoun2ngdepartment

•  Federalagencies:ADA(AmericanswithDisabili2esAct)

7

Page 8: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

RequirementsEngineering:Whatisaso#warerequirementsspecificaPon?

•  Documentstheassump2onsabout,featuresrequested,andbehaviorofagivenso4wareapplica2onexceptedbytheusers

•  Definesasetofrequirementsthatmustbesa2sfiedbytheso4wareapplica2on

8

Page 9: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

RequirementsEngineering:Twokeytypesofrequirements

•  Non-funcPonalrequirement:Aqualityconstraintontheso4wareapplica2on–  e.g.,extensibility,scalability,usability

•  FuncPonalrequirement:Anintended(orunintended)behavioroftheso4wareapplica2on–  e.g,TheThreeinaRowgamemustusetheMVCarchitecturepaRern.

9

NOTE)Thereareothertypesofrequirementstodescribeassump1ons,features,andusagescenarios(e.g.,UMLusecases).

Page 10: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

RequirementsEngineering:Twokeytypesofrequirements

•  Non-funcPonalrequirement:Aqualityconstraintontheso4wareapplica2on–  e.g.,extensibility,scalability,usability

•  FuncPonalrequirement:Anintended(orunintended)behavioroftheso4wareapplica2on–  e.g,TheThreeinaRowgamemustusetheMVCarchitecturepaRern.

10

NOTE)Thereareothertypesofrequirementstodescribeassump1ons,features,andusagescenarios(e.g.,UMLusecases).

Page 11: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

RequirementsEngineering:Phases

1.  Elicita2on2.  Specifica2on3.  Analysis4.  Management

11

Requirement Design Implementa2on

Page 12: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

RequirementsEngineering:Phases

1.  Elicita2on2.  Specifica2on3.  Analysis4.  Management

12

Requirement Design Implementa2on

Page 13: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

RequirementsEngineering:Phases

1.  Elicita2on2.   SpecificaPon3.  Analysis4.  Management

13

Requirement Design Implementa2on

Page 14: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

Example:ThreeinaRowgameapp(fromHomework1)

•  ApplytheMVC(Model-View-Controller)architecturepaRern

•  FollowThreeinaRowgamerules

14

Page 15: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

SpecificaPon:Naturallanguage

•  Elicita2ono4enproducesrequirementswriReninnaturallanguage

•  Sample:1.  The‘ThreeinaRow’gameappmustusetheMVC

architecturepaRern.a.  Theremustbeasinglegamemodel.b.  Oncethenewgamemodeliscreated,thatmodelcanhaveits

statechanged.c.  Ifthegamemodelhasastatechange,thenitsgameviewmust

beupdated.d.  …

2.  …15

Page 16: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

SpecificaPon:Disadvantagesofnaturallanguage

•  Naturallanguageiso4enambiguous•  Suchambiguitycanleadtohumanmisunderstandings

•  Theambiguityalsomeansverifica2on&valida2oncannotbecarriedoutbyapplyingautomatedtools,e.g.,– Tes2ng,modelchecking

16

Page 17: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

SpecificaPon:Disadvantagesofnaturallanguage

•  Naturallanguageiso4enambiguous•  Suchambiguitycanleadtohumanmisunderstandings

•  Theambiguityalsomeansverifica2on&valida2oncannotbecarriedoutbyapplyingautomatedtools,e.g.,– Tes2ng,modelchecking

17

ThereforemathemaPcalnotaPons(e.g.,finitestateautomata)arecommonlyusedbecausetheyarerigorouslydefined

Page 18: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

SpecificaPon:Finitestateautomaton(FSA)

18

Eventsequenceoveranalphabet(meaningasetofevents)

Finitestateautomaton(FSA)

accept reject

or

Page 19: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

FSA:Sample1a

19

1 2

viol

gameModelNew

Theremustbeasinglegamemodel.

gameModelNew

gameModelNew

Page 20: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

FSA:Sample1a

20

1 2

gameModelNew

Theremustbeasinglegamemodel.

Page 21: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

FSA:Sample1a

21

1 2

gameModelNew

Theremustbeasinglegamemodel.

Eventsequence:[gameModelNew,gameModelNew]

Page 22: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

FSA:Sample1a

22

1 2

gameModelNew

Theremustbeasinglegamemodel.

Eventsequence:[gameModelNew,gameModelNew]

reject

Page 23: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

FSA:Sample1a

23

Eventsequence:[gameModelNew]

1 2

gameModelNew

Theremustbeasinglegamemodel.

Page 24: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

FSA:Sample1a

24

Eventsequence:[gameModelNew]

accept

1 2

gameModelNew

Theremustbeasinglegamemodel.

Page 25: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

FSA:Sample1a

25

Eventsequence:[]

1 2

gameModelNew

Theremustbeasinglegamemodel.

Page 26: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

FSA:Sample1a

26

Eventsequence:[]

1 2

gameModelNew

Theremustbeasinglegamemodel.

reject

Page 27: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

FSA:Sample1b

27

1 3

gameModelNew gameModelStateChange

2

gameModelStateChange

Page 28: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

FSA:Sample1b

28

1 3

gameModelNew gameModelStateChange

Someeventsequencesthatareaccepted(i.e.posi2veexamples)?

2

gameModelStateChange

Page 29: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

FSA:Sample1b

29

1 3

gameModelNew gameModelStateChange

Someeventsequencesthatareaccepted(i.e.posi2veexamples)?[gameModelNew][gameModelNew,gameModelStateChange]

2

gameModelStateChange

Page 30: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

FSA:Sample1b

30

1 3

gameModelNew gameModelStateChange

Othereventsequencesthatarerejected(i.e.nega2veexamples)?

2

gameModelStateChange

Page 31: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

FSA:Sample1b

31

1 3

gameModelNew gameModelStateChange

Othereventsequencesthatarerejected(i.e.nega2veexamples)?[][gameModelStateChange][gameModelNew,gameModelNew]

2

gameModelStateChange

Page 32: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

FSA:Sample1b

32

1 3

gameModelNew gameModelStateChange

Oncethenewgamemodeliscreated,thatmodelcanhaveitsstatechanged.

2

gameModelStateChange

Page 33: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

FSA:FormaldefiniPonRepresentedasa5tuple:•  E:Thealphabetasasetofevents•  S:Thesetofstates•  T:Thesetoftransi2onswhereeachtransi2onisadirectededgefromasourcestatesoneventetotargetstatet

•  s0:Thestartstate•  A:Thesetofaccep2ngstates

33

NOTE)Canbeautoma2callyconvertedtoaregularexpression

Page 34: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

FSA:Disadvantages

•  NaturallanguageisgenerallymoreaccessiblethanFSAs

•  Handwri2ngFSAscanbeerrorproneand2meconsuming

34

Page 35: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

FSA:Disadvantages

•  NaturallanguageisgenerallymoreaccessiblethanFSAs

•  Handwri2ngFSAscanbeerrorproneand2meconsuming

35

SpecificaPonpa[ernshavebeenidenPfiedofcommonlyoccurringintended(orunintended)behaviorsofso#wareapplicaPons

Page 36: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

PropertyspecificaPonpa[ern:FormaldefiniPon

•  Consistsofa:– Scopecapturespartsofthetracewherethebehaviormustbesa2sfied(e.g.,Global)

– Behaviorcapturesoccurrenceororderofevents/proposi2ons(e.g.,BoundedexistenceofgameModelNew)

•  Providesmappingtovariouspropertyspecifica2onlanguages(e.g.,RegularExpressions,inthiscasegameModelNew)

36[hRps://maRhewbdwyer.github.io/psp/]

Page 37: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

PropertyspecificaPonpa[ern:Scopes

37

Page 38: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

PropertyspecificaPonpa[ern:Behaviors

38

Behavior

Occurrenceofevent/proposi2onA

Orderofevents/proposi2onsAandB (Chained)Response

(Chained)Precedence

Absence

Universality

(Bounded)Existence

Page 39: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

PropertyspecificaPonpa[ern:Behaviors

39

Behavior

Occurrenceofevent/proposi2onA

Orderofevents/proposi2onsAandB (Chained)Response

(Chained)Precedence

Absence

Universality

(Bounded)Existence

Page 40: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

40

PropertyspecificaPonpa[ern:PrecedencedescripPon

Page 41: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

41

PropertyspecificaPonpa[ern:Precedenceregularexpressions

Page 42: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

42

PropertyspecificaPonpa[ern:Precedenceregularexpressions

Page 43: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

Propertypa[ernspecificaPon:Sample1b

43

1 3

gameModelNew gameModelStateChange

Oncethenewgamemodeliscreated,thatmodelcanhaveitsstatechanged.

2

gameModelStateChangeBehavior:gameModelNewmustprecedegameModelStateChangeScope:Globally

Page 44: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

PropertyspecificaPonpa[erns:Disadvantages

•  Use80/20rule– MayneedtohandwriteFSAs

•  Don’tprovidesupportforreal-2meorprobabilis2cconstraints– Hasbeenextended[SeehRp://ps-paRerns.wikidot.com]

•  Designedforexperts– CanbedifficultfornovicestoselectamongpaRernsandcustomizethem

44

Page 45: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

PropertyspecificaPonpa[erns:Disadvantages

•  Use80/20rule– MayneedtohandwriteFSAs

•  Don’tprovidesupportforreal-2meorprobabilis2cconstraints– Hasbeenextended[SeehRp://ps-paRerns.wikidot.com]

•  Designedforexperts– Canbedifficultfornovicestoselectamongpa[ernsandcustomizetheselectedpa[ern

45

Page 46: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

PROPELtool:What?

•  Buildsonthepropertyspecifica2onpaRernsspecifiedasfinitestateautomata

•  ProvidesguidancetoselectamongthepaRernsandcustomizethatpaRern

46[hRp://laser.cs.umass.edu/tools/propel.shtml]

Page 47: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

PROPELtool:Userinterface

47[AvailablefromhRp://laser.cs.umass.edu/release/]

Scope

Behavior

Page 48: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

PROPELtool:DemonstraPon

Specifythefollowing:“Ifthegamemodelhasastatechangethenitsgameviewmustbeupdated”

48

Page 49: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

PROPELtool:SampleFSA1c

49

Behavior:gameModelStateChangemusthaveresponsegameViewUpdateScope:Globally

Page 50: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

PROPELtool:SampleDNL1c

50

Page 51: CS 520hconboy/class/2021Spring/CS... · 2021. 3. 2. · CS 520 Theory and Prac2ce of So4ware Engineering Spring 2021 Soware requirements March 2, 2021

Finalproject:GroupandtopicselecPon

•  Formteamof4or5students•  Selectoneofthefollowing4topics:

1.  MSRminingchallenge:2020or20212.  Replica2onstudy3.  MLdevelopmenttoolkit4.  EleNa:Eleva2on-basednaviga2on5.  Proposedyourowngroupproject

•  Due:ThursdayMarch4,20219:00PMEDThRps://people.cs.umass.edu/~hconboy/class/2021Spring/CS520/finalProject.pdf