《软件需求分析课件:Chap 4-Iteration1-OOA》由会员分享,可在线阅读,更多相关《软件需求分析课件:Chap 4-Iteration1-OOA(76页珍藏版)》请在金锄头文库上搜索。
1、ElaborationIteration1-OOApCh8.Iteration1BasicspCh9.DomainModelspCh10.SystemSequenceDiagramspCh11.OperationContracts1Chapter8.Iteration1BasicsoObjectivesnDefinethefirstiterationintheelaborationphase.nMotivatethefollowingchaptersinthissection.nDescribekeyinceptionandelaborationphaseconcepts.2Iteration
2、1RequirementsandEmphasisoCoreOOA/DSkillsoNextGen POSnImplementabasic,keyscenariooftheProcessSaleusecase:enteringitemsandreceivingacashpaymentnImplementaStartUpusecaseasnecessarytosupporttheinitializationneedsoftheiterationnNothingfancyorcomplexishandled,justasimplehappypathscenario,andthedesignandim
3、plementationtosupportitnThereisnocollaborationwithexternalservices,suchasataxcalculatororproductdatabasenNocomplexpricingrulesareapplied3InIterativeDevelopmentWeDontImplementAlltheRequirementsatOnceoSubsetsofthecompleterequirementsorusecasesnasimplifiedversionofthecompleteProcessSaleusecase-onesimpl
4、ecash-onlyscenariookeyunderstandinginiterativelifecyclemethodsnstartproduction-qualityprogrammingandtestingforasubsetoftherequirementsnstartthatdevelopmentbeforealltherequirementsanalysisiscomplete4IncrementalDevelopmentfortheSameUseCaseAcrossIterations5Process:InceptionandElaborationoWhat Happened
5、in Inception?nInceptionisashortsteptoelaborationnItdeterminedbasicfeasibility,risk,andscope,todecideiftheprojectisworthmoreseriousinvestigationoOn to ElaborationnElaborationistheinitialseriesofiterationsnthecore,riskysoftwarearchitectureisprogrammedandtestednthemajorityofrequirementsarediscoveredand
6、stabilizednthemajorrisksaremitigatedorretired6oRankrequirementsas:nHigh(scorehighonallrankings;hardtoaddlate)nMedium(affectssecuritydomain)nLowby:nRisk(includesbothtechnicalcomplexityandotherfactors,suchasuncertaintyofeffortandusability)nCoverage(allmajorpartsofthesystemaretackledinearlyiterations)n
7、Criticality(referstofunctionstheclientconsidersofhighbusinessvalue)oRankingisdonebeforeeachiterationProcess:PlanningtheNextIteration7Chapter9.DomainModelsoObjectivesnIdentifyconceptualclassesrelatedtothecurrentiterationnCreateaninitialdomainmodelnModelappropriateattributesandassociations81.WhatisaDo
8、mainModel?oOOsoftwaresystemconsistsofagroupofsoftwareobjectsnWheretofindtheseobjectsforaspecificsoftwaresystem?oDomain model nillustratesmeaningfulconceptualclassesintheproblemdomainnisasourceofinspirationfordesignsoftwareobjectsngivesaconceptualvisualisationoftheproblem,itshows:odomainobjectsorconc
9、eptualclassesoassociationsbetweenconceptualclassesoattributesofconceptualclassesoIdentifyingarichsetofconceptualclassesisattheheartofOOanalysis9ADomainModelExample10SampleUPartifactinfluence11oAdomainmodeldoesnotrepresentsoftwareclassesnSoftwareartifacts,suchasawindoworadatabasenResponsibilitiesorme
10、thodsDomainModelsAreNotModelsofSoftwareComponents12DomainmodelsareasteppingsteptodesignFromAnalysistoDesign13oGiventhecurrentrequirementsunderconsideration:nFindtheconceptualclasses.nDrawthemasclassesinaUMLclassdiagram.nAddassociationsandattributes.2.HowtocreateaDomainModel?14oThreemainstrategiesnRe
11、useormodifyexistingmodels!(dothisasmuchaspossible!AnalysisPattern)nThinkhardanduseacategorylistnIdentifynounphrasesinrequirementsoAll3strategiesshouldbeusedinitiallynevenifthatleadstomuchoverlappingnitshouldnottaketoolonganywaynbestwaytoarriveatarichsetofconceptualclassesHowtoFindConceptualClasses?1
12、5UsingaCategoryListConceptual Class CategoryExamplesbusiness transactionsGuideline:Thesearecritical(theyinvolvemoney),sostartwithtransactions.Sale,PaymentReservationtransaction line itemsGuideline:Transactionsoftencomewithrelatedlineitems,soconsiderthesenext.SalesLineItemproduct or service related t
13、o a transaction or transaction line itemGuideline:Transactionsareforsomething(aproductorservice).ItemFlight,Seat,Mealwhere is the transaction recorded?Guideline:Important.Register,Ledgerroles of people or organizations related to the transaction; actors in the use caseGuideline:Weusuallyneedtoknowab
14、outthepartiesinvolvedinatransaction.Cashier,Customer,StoreMonopolyPlayerPassenger,Airline16Conceptual Class CategoryExamplesplace of transaction; place of serviceStoreAirport,Plane,Seatnoteworthy events, often with a time or place we need to rememberSale,PaymentMonopolyGameFlightphysical objectsGuid
15、eline:Thisisespeciallyrelevantwhencreatingdevice-controlsoftware,orsimulations.Item,RegisterBoard,Piece,DieAirplanedescriptions of thingsProductDescriptionFlightDescriptioncatalogsGuideline:Descriptionsareofteninacatalog.ProductCatalogFlightCatalogcontainers of things (physical or information)Store,
16、BinBoardAirplanethings in a containerItemSquare(inaBoard)Passengerother collaborating systemsCreditAuthorizationSystemAirTrafficControlContinued 17Conceptual Class CategoryExamplesrecords of finance, work, contracts, legal mattersReceipt,LedgerMaintenanceLogfinancial instrumentsCash,Check,LineOfCred
17、itTicketCreditschedules, manuals, documents that are regularly referred to in order to perform workDailyPriceChangeListRepairScheduleContinued 18oLinguisticanalysisnRequirementsmustbereadveryclosely(especiallyfully-dressedusecases)andnounsorsequencesofnounsidentified:oThisyieldscandidateconceptualcl
18、asses.nNaturallanguageisimpreciseandambiguous,soyouneedtousejudgmentoExamplefromtheProcess Salefullydressedusecase(seepreviousseparatedocument):notethatwerestrictourselvestocurrentrequirements(e.g.cashpaymentonly)UsingaNounPhrasesIdentification19Main Success Scenario (or Basic Flow):1.Customerarrive
19、satPOS checkoutwithgoodsand/orservicestopurchase.2.Cashierstartsanewsale.3.Cashierentersitem identifier.4.Systemrecordssale line itemandpresentsitem description,price,andrunningtotal.Pricecalculatedfromasetofprice rules.Cashierrepeatssteps3-4untilindicatesdone.5.Systempresentstotalwithtaxescalculate
20、d.6.CashiertellsCustomerthetotal,andasksforpayment.7.CustomerpaysandSystemhandlespayment.8.SystemlogscompletedsaleandsendssaleandpaymentinformationtotheexternalAccountingsystem(foraccountingandcommissions)andInventorysystem(toupdateinventory).9.Systempresentsreceipt10. Customerleaveswithreceiptandgo
21、ods(ifany).20Extensions (or Alternative Flows): 7a.Payingbycash:Cashierentersthecashamount tendered.Systempresentsthebalance due,andreleasesthecash drawer.CashierdepositscashtenderedandreturnsbalanceincashtoCustomer.SystemrecordsthecashpaymentoUsingtheseapproachesweendupwithcandidateconceptualclasse
22、s:nSomewillbeoutsidethecurrentrequirements(e.g.pricerules);nSomewillberedundant(e.g.goodsisbetterdescribedbyitem);nSomewillbeattributesofconceptsratherthanconceptsthemselves(e.g.price);21oThereisnocorrect listofconceptualclasses!Initial POS Domain ModelPOSConceptualClasses221)shouldReceipt beaconcep
23、tualclass?nAreceiptiscertainlynoteworthy(allowsrefunds):FORnAlltheinformation(?Sure?E.g.receiptnumber;orshouldthatbeSalenumber?)onthereceiptishoweverderivedfromotherconceptualclasses(fromSale):AGAINST;nReturnsarenotbeingconsideringinthisiteration:AGAINST;So we wont include it now:itmaybeneededwhenco
24、nsideringtheHandle Returnsusecase(Makeanotetothateffect)23oRepresentingsomethingasanattributewhenitshouldbeaconceptoGuideline:ifsomethingisnotanumberorastringthenitisprobablyaconceptualclass,notanattribute.StorephoneNumberSaleSalestoreOr 2)ACommonmistakeinadomainmodelAirportnameFlightFlightdestinati
25、onOr 24oThinkaboutdescriptionclasseswhencreatinganinitiallistofconceptualclasses(orduringrefactoring):nAdescriptionclasscontainsinformationthatdescribessomethingelse3)WhentoModelwithDescriptionClasses25nAddadescriptionclass(forexample,ProductDescription)when:oThereneedstobeadescriptionaboutanitemors
26、ervice,independentofthecurrentexistenceofanyexamplesofthoseitemsorservices.oDeletinginstancesofthingstheydescribe(forexample,Item)resultsinalossofinformationthatneedstobemaintained,butwasincorrectlyassociatedwiththedeletedthing.oItreducesredundantorduplicatedinformation.26oAnotherexample:Description
27、sintheAirlineDomain27oSomeconceptualclasseswillbemissedatthisstage:aimatagoodinitialdomain,notperfection.oUseterminology(e.g.namesofconcepts,descriptionsofusecases)thatmakesenseintheapplicationcontext.oWecanalsomodelun-realworldproblems:E.g.inatelecommunicationdomain:Message,Connection,Port,Dialog,R
28、oute,Protocolwouldbecandidateconceptualclasses.Discussion283.AssociationsoAnassociationisarelationshipbetweenclassesthatindicatesomemeaningfulandinterestingrelationshipCriteria for Useful Associations oAssociationsforwhichknowledgeoftherelationshipneedstobepreservedforsomeduration(“need-to-know” ass
29、ociation) oSalesLineIteminstancesareassociatedwithaSale ?oaCashierhaslooked-upaparticularProductDescription ?oAssociationsderivedfromtheCommonAssociationList29TheUMLAssociationNotation30oBasedonaClassName-VerbPhrase-ClassNameformatwheretheverbphrasecreatesasequencethatisreadableandmeaningful.NamingA
30、ssociations31oEachendofanassociationiscalledarole.Rolesmayoptionallyhave:nmultiplicityexpressionnname(toclarifymeaning)nnavigability(notrelevantduringOOA)oThemultiplicitydefineshowmanyinstancesofaclassAcanbeassociatedwithoneinstanceofaclassB3233oThemultiplicityvaluecommunicateshowmanyinstancescanbev
31、alidlyassociatedwithanother,ataparticularmoment,ratherthanoveraspanoftimenA CarStocked-byoneDealeroAddingmultiplicityvaluestotherolesofanassociationhelpsexploringtheproblemdomain.oTwoclassesmayhavemultipleassociationsbetweentheminaUMLclassdiagram;thisisnotuncommon:34oTwomainways:nwhatneedtoknowassoc
32、iationsarenecessarygivenourcurrentlistofcandidateconcepts?nUsingalistofassociationcategories.Association CategoryExamplesA is a transaction related to another transaction BCashPayment-SaleCancellation-ReservationA is a line item of a transaction BSalesLineItem-SaleA is a product or service for a tra
33、nsaction (or line item) BItem-SalesLineItemFlight-ReservationA is a role related to a transaction BCustomer-PaymentPassenger-TicketA is a physical or logical part of BDrawer-RegisterSquare-BoardSeat-Airplane35HowtoFindAssociations?Continued Association CategoryExamplesA is physically or logically co
34、ntained in/on BRegister-StoreItem-ShelfSquare-BoardPassenger-AirplaneA is a description for BProductDescription-ItemFlightDescription-FlightA is known/logged/recorded/reported/captured in BSale-RegisterPiece-SquareA is a member of BCashier-StorePlayer-MonopolyGamePilot-AirlineA is an organizational
35、subunit of BDepartmentStoreMaintenanceAirline36Continued Association CategoryExamplesA uses or manages or owns BCashier-RegisterPlayer-PiecePilot-AirplaneA is next to BSalesLineItem-SalesLineItemSquare-SquareCity-City37Partial POS Domain Model384.AttributesoAnattributeisalogicaldatavaluesofanobjecto
36、Includeattributesthattherequirements(forexample,usecases)suggestorimplyaneedtorememberinformationoForexample,areceipt(whichreportstheinformationofasalenormallyincludesadateandtime,thestorenameandaddress,andthecashierID,amongmanyotherthings.Therefore,nSaleneedsadateTimeattribute.nStoreneedsanameandad
37、dress.nCashierneedsanID.39oThefullsyntax:visibility name : type multiplicity = default property-stringoreadOnlyisprobablythemostcommonpropertystringforattributes.Privatevisibility(-)isusuallyimplicit.oAttributemultiplicitycanbeusedtoindicatetheoptionalpresenceofavalue,orthenumberofobjectsthatcanfill
38、a(collection)attribute.40UMLAttributeNotationDerivedAttributesoAnattributethatcanbederivedbyotherinformation.41WhatareSuitableAttributeintheDomainModeloFocus on Data Type Attribute in the Domain Model nTheattributesshouldbe“primitive”datatypesEx.Numbers,Booleans,Date,String,Time,Character,nTheattrib
39、utes,normally,shouldnotbeacomplexdomainconceptEx.Sale,AirportoAcommonmistakeismodelingacomplexdomainconceptasanattribute4243WhentoDefineNewDataTypeClassesoRepresentwhatmayinitiallybeconsideredanumberorstringasanewdatatypeclassinthedomainmodelif:oItiscomposedofseparatesections.nphonenumber,nameofpers
40、onoThereareoperationsassociatedwithit,suchasparsingorvalidation.nsocialsecuritynumberoIthasotherattributes.npromotionalpricecouldhaveastart(effective)dateandenddateoItisaquantitywithaunit.npaymentamounthasaunitofcurrencyoItisanabstractionofoneormoretypeswithsomeofthesequalities.nitemidentifierinthes
41、alesdomainisageneralizationoftypessuchasUniversalProductCode(UPC)andEuropeanArticleNumber(EAN)44WheretoIllustrateTheseDataTypeClasses?oSinceItemIDisadatatype,itcanbeshownintheattributecompartmentoftheclassboxoIfItemIDisanewtypewithitsownattributesandassociations,itcanbeshownasaconceptualclassinitsow
42、nboxoItdependswhatyouwanttoemphasizeinthediagram45NoAttributesRepresentingForeignKeysoAttributesshouldnotbeusedtorelateconceptualclassesinthedomainmodel.oThemostcommonviolationofthisprincipleistoaddakindofforeignkeyattribute46ModelingAttributeQuantitiesandUnits47AttributesintheDomainModels48NextGenP
43、OSDomainModel(withattributes)49oIniterativedevelopment,weincrementallyevolveadomainmodeloverseveraliterations.oIneach,thedomainmodelislimitedtothepriorandcurrentscenariosunderconsideration,ratherthanexpandingtoabigbangwaterfall-stylemodelthatearlyonattemptstocaptureallpossibleconceptualclassesandrel
44、ationships.nForexample,thisPOSiterationislimitedtoasimplifiedcash-onlyProcessSalescenario;therefore,apartialdomainmodelwillbecreatedtoreflectjustthatnotmore.5.Process:IterativeandEvolutionaryDomainModelling50oDomainmodelingisaveryimportantactivityinOOA.Wemustensurethatthemodelbuiltwillbeabletowithst
45、andtheinformationrequirementsofthecurrentiteration.oInaddition,themodelwillgrowinsubsequentiterationsaremorerequirementsareexamined.oIdentifyingarichsetofconceptualclassesisattheheartofOOanalysisoDomainModelingisoftencalledBusinessModeling;andisbothstartedandcompletedintheelaborationphase.Conclusion
46、s51Chapter10.SystemSequenceDiagramsoObjectivesnIdentifysystemeventsnCreatesystemsequencediagramsforusecasescenarios5253SystemSequenceDiagram(SSD)oTheOOADchallengenUCsarefunctionalbutSystemisOOnThisisamodelingparadigmmismatchnHowtomakethefunctional-OOtransitionoWithoutlosinganyreqsoBeingabletodemonst
47、ratenoreqsarelostoEndupwithacorrect,robust&flexibleOOsystemoUltimately,everyreqmustbeanassignedresponsibilityforsomeobject!5455SSDsoSSDsareoneofthebooksbestideasoSSDisthekeymodelthatnLinksUCswithOOmodels(e.g.,class&sequence)nSupportedbyoperationcontracts(nextchp)nEstablishestraceabilityofreqsintoOOm
48、odels5656SSDsoAUCspecifiesfunction-alityoAUCscenarioisatime-orderedseriesoffunctioncallsthatActorinvokesonSystemoLarmancallsthemsystemoperationsorsystemeventsoKeytasksareoIdentifythefunctionsinaUCscenariooTranslatethemintoUMLfunctionsyntaxoDrawasequencediagram(easypart)oEasierifyouhavesimple,complet
49、eUCsSystemSequenceDiagram(SSD)oIllustrateinputandoutputeventsrelatedtothesystemunderdiscussionoTheusecasetextanditsimpliedsystemeventsareinputtoSSDcreationoSSDisusedtodescribeaparticularscenarioofausecasenmainsuccessscenarionfrequentorcomplexalternativescenariooForeachsystemevents,thereisasystemoper
50、ation(1to1)oTheSSDoperationsncanbeanalyzedintheoperationcontractsnDetailedintheGlossarynServeasthestartingpointfordesigningcollaborationobjects57SSDforaProcessSaleScenario58SSDsarederivedfromusecases;theyshowonescenario5960ProcessSaleUCUC: Process Sale makeNewSale()1.User selects new sale option (Re
51、quest-invocation)2.System requests item identifier(Response-return) enterItem(itemID, quantity)3.User enters item identifier & quantity4.System records sale of item, and 5.System displays item description, price, current totalSteps 2-5 repeated until user finished endSale()6.User selects sale finish
52、ed option7.System displays total and taxes due makePayment(amount)8.User enters payment information9.System handles payment recordSale()10.System logs completed sale and sends sale information to Accounting System and Inventory System11.System generates receiptChooseeventandoperationnamesatanabstrac
53、tlevel61Process:IterativeandEvolutionarySSDsoDontcreateSSDsforallscenarios,drawthemonlyforthescenarioschosenforthenextiterationoSSDsarepartoftheUse-Case,notexplicitlymentionedintheoriginalUPoMostSSDsarecreatedduringelaboration,whenitisusefultoidentifythedetailsofthesystemeventstoclarifywhatmajoroper
54、ationsthesystemmustbedesignedtohandle,writesystemoperationcontracts,andpossiblytosupportestimation62Chapter11.OperationContractsoObjectivesnDefinesystemoperations.nCreatecontractsforsystemoperations6364WhatisaSystemOperation?65OperationContractsodescribedetailedsystembehaviorintermsofstatechangestoo
55、bjectsintheDomainmodel,afterasystemoperationhasexecutedoSpecify the pre- and post-conditions of each system operationoPost-conditions are most importantnWhat happened in system as a result of the operations invocation66OperationContractsOC2:enterItem67WhataretheSectionsofaContract68WhyOCpost-conditi
56、ons?oThinkaboutyourdomainmodelnIdentifiesobjects(+attributes)andassociationsoTheOClinksasystemoperationtospecificobjectsinthedomainmodeloIndicateswhichobjectsareaffectedbytheoperationoWillhelpwithassignmentofresponsibilities69PostconditionsoThepostconditionsdescribechangesinthestateofobjectsintheDom
57、ainModel.oDomainModelstatechangesincludeninstancescreatednassociationsformedorbrokennattributeschanged70oExample enterItem Postconditions nASalesLineIteminstancesliwascreated(instancecreation)nsli.quantitybecamequantity(attributemodification)nsliwasassociatedwiththecurrentSale(associationformed)nsli
58、wasassociatedwithaProductSpecification,basedonItemIDmatch(associationformed)71WhenAreContractsUseful?oTheusecasearethemainrepositoryofrequirementsfortheprojectoContractsareneededonlywherethedetailsandcomplexityofrequiredstatechangesareawkwardtocaptureinusecases72HowtoCreateandWriteContracts?oIdentif
59、ysystemoperationsfromSSDsoForsystemoperationsthatarecomplexandperhapssubtleintheirresults,orwhicharenotclearintheusecase,constructacontractoTodescribethepostconditions,usedthefollowingcategories:ninstancecreationanddeletionnattributemodificationnassociationsformedandbroken73ExampleOC4:makePayment7475ConclusionoCrucial to realize that UCs, domain model, SSDs and OCs are intimately relatedoTo create OCs, for complex operations.nIdentify system operations on SSDsnSpecify post-conditions oInstances createdoAssociations formed/broken (easiest to miss)oAttributes modified