资源预览内容
第1页 / 共76页
第2页 / 共76页
第3页 / 共76页
第4页 / 共76页
第5页 / 共76页
第6页 / 共76页
第7页 / 共76页
第8页 / 共76页
第9页 / 共76页
第10页 / 共76页
亲,该文档总共76页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
ElaborationIteration1-OOApCh8.Iteration1BasicspCh9.DomainModelspCh10.SystemSequenceDiagramspCh11.OperationContracts1Chapter8.Iteration1BasicsoObjectivesnDefinethefirstiterationintheelaborationphase.nMotivatethefollowingchaptersinthissection.nDescribekeyinceptionandelaborationphaseconcepts.2Iteration1RequirementsandEmphasisoCoreOOA/DSkillsoNextGen POSnImplementabasic,keyscenariooftheProcessSaleusecase:enteringitemsandreceivingacashpaymentnImplementaStartUpusecaseasnecessarytosupporttheinitializationneedsoftheiterationnNothingfancyorcomplexishandled,justasimplehappypathscenario,andthedesignandimplementationtosupportitnThereisnocollaborationwithexternalservices,suchasataxcalculatororproductdatabasenNocomplexpricingrulesareapplied3InIterativeDevelopmentWeDontImplementAlltheRequirementsatOnceoSubsetsofthecompleterequirementsorusecasesnasimplifiedversionofthecompleteProcessSaleusecase-onesimplecash-onlyscenariookeyunderstandinginiterativelifecyclemethodsnstartproduction-qualityprogrammingandtestingforasubsetoftherequirementsnstartthatdevelopmentbeforealltherequirementsanalysisiscomplete4IncrementalDevelopmentfortheSameUseCaseAcrossIterations5Process:InceptionandElaborationoWhat Happened in Inception?nInceptionisashortsteptoelaborationnItdeterminedbasicfeasibility,risk,andscope,todecideiftheprojectisworthmoreseriousinvestigationoOn to ElaborationnElaborationistheinitialseriesofiterationsnthecore,riskysoftwarearchitectureisprogrammedandtestednthemajorityofrequirementsarediscoveredandstabilizednthemajorrisksaremitigatedorretired6oRankrequirementsas:nHigh(scorehighonallrankings;hardtoaddlate)nMedium(affectssecuritydomain)nLowby:nRisk(includesbothtechnicalcomplexityandotherfactors,suchasuncertaintyofeffortandusability)nCoverage(allmajorpartsofthesystemaretackledinearlyiterations)nCriticality(referstofunctionstheclientconsidersofhighbusinessvalue)oRankingisdonebeforeeachiterationProcess:PlanningtheNextIteration7Chapter9.DomainModelsoObjectivesnIdentifyconceptualclassesrelatedtothecurrentiterationnCreateaninitialdomainmodelnModelappropriateattributesandassociations81.WhatisaDomainModel?oOOsoftwaresystemconsistsofagroupofsoftwareobjectsnWheretofindtheseobjectsforaspecificsoftwaresystem?oDomain model nillustratesmeaningfulconceptualclassesintheproblemdomainnisasourceofinspirationfordesignsoftwareobjectsngivesaconceptualvisualisationoftheproblem,itshows:odomainobjectsorconceptualclassesoassociationsbetweenconceptualclassesoattributesofconceptualclassesoIdentifyingarichsetofconceptualclassesisattheheartofOOanalysis9ADomainModelExample10SampleUPartifactinfluence11oAdomainmodeldoesnotrepresentsoftwareclassesnSoftwareartifacts,suchasawindoworadatabasenResponsibilitiesormethodsDomainModelsAreNotModelsofSoftwareComponents12DomainmodelsareasteppingsteptodesignFromAnalysistoDesign13oGiventhecurrentrequirementsunderconsideration:nFindtheconceptualclasses.nDrawthemasclassesinaUMLclassdiagram.nAddassociationsandattributes.2.HowtocreateaDomainModel?14oThreemainstrategiesnReuseormodifyexistingmodels!(dothisasmuchaspossible!AnalysisPattern)nThinkhardanduseacategorylistnIdentifynounphrasesinrequirementsoAll3strategiesshouldbeusedinitiallynevenifthatleadstomuchoverlappingnitshouldnottaketoolonganywaynbestwaytoarriveatarichsetofconceptualclassesHowtoFindConceptualClasses?15UsingaCategoryListConceptual Class CategoryExamplesbusiness transactionsGuideline:Thesearecritical(theyinvolvemoney),sostartwithtransactions.Sale,PaymentReservationtransaction line itemsGuideline:Transactionsoftencomewithrelatedlineitems,soconsiderthesenext.SalesLineItemproduct or service related to 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:Weusuallyneedtoknowaboutthepartiesinvolvedinatransaction.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 objectsGuideline:Thisisespeciallyrelevantwhencreatingdevice-controlsoftware,orsimulations.Item,RegisterBoard,Piece,DieAirplanedescriptions of thingsProductDescriptionFlightDescriptioncatalogsGuideline:Descriptionsareofteninacatalog.ProductCatalogFlightCatalogcontainers of things (physical or information)Store,BinBoardAirplanethings in a containerItemSquare(inaBoard)Passengerother collaborating systemsCreditAuthorizationSystemAirTrafficControlContinued 17Conceptual Class CategoryExamplesrecords of finance, work, contracts, legal mattersReceipt,LedgerMaintenanceLogfinancial instrumentsCash,Check,LineOfCreditTicketCreditschedules, manuals, documents that are regularly referred to in order to perform workDailyPriceChangeListRepairScheduleContinued 18oLinguisticanalysisnRequirementsmustbereadveryclosely(especiallyfully-dressedusecases)andnounsorsequencesofnounsidentified:oThisyieldscandidateconceptualclasses.nNaturallanguageisimpreciseandambiguous,soyouneedtousejudgmentoExamplefromtheProcess Salefullydressedusecase(seepreviousseparatedocument):notethatwerestrictourselvestocurrentrequirements(e.g.cashpaymentonly)UsingaNounPhrasesIdentification19Main Success Scenario (or Basic Flow):1.CustomerarrivesatPOS checkoutwithgoodsand/orservicestopurchase.2.Cashierstartsanewsale.3.Cashierentersitem identifier.4.Systemrecordssale line itemandpresentsitem description,price,andrunningtotal.Pricecalculatedfromasetofprice rules.Cashierrepeatssteps3-4untilindicatesdone.5.Systempresentstotalwithtaxescalculated.6.CashiertellsCustomerthetotal,andasksforpayment.7.CustomerpaysandSystemhandlespayment.8.SystemlogscompletedsaleandsendssaleandpaymentinformationtotheexternalAccountingsystem(foraccountingandcommissions)andInventorysystem(toupdateinventory).9.Systempresentsreceipt10. Customerleaveswithreceiptandgoods(ifany).20Extensions (or Alternative Flows): 7a.Payingbycash:Cashierentersthecashamount tendered.Systempresentsthebalance due,andreleasesthecash drawer.CashierdepositscashtenderedandreturnsbalanceincashtoCustomer.SystemrecordsthecashpaymentoUsingtheseapproachesweendupwithcandidateconceptualclasses:nSomewillbeoutsidethecurrentrequirements(e.g.pricerules);nSomewillberedundant(e.g.goodsisbetterdescribedbyitem);nSomewillbeattributesofconceptsratherthanconceptsthemselves(e.g.price);21oThereisnocorrect listofconceptualclasses!Initial POS Domain ModelPOSConceptualClasses221)shouldReceipt beaconceptualclass?nAreceiptiscertainlynoteworthy(allowsrefunds):FORnAlltheinformation(?Sure?E.g.receiptnumber;orshouldthatbeSalenumber?)onthereceiptishoweverderivedfromotherconceptualclasses(fromSale):AGAINST;nReturnsarenotbeingconsideringinthisiteration:AGAINST;So we wont include it now:itmaybeneededwhenconsideringtheHandle Returnsusecase(Makeanotetothateffect)23oRepresentingsomethingasanattributewhenitshouldbeaconceptoGuideline:ifsomethingisnotanumberorastringthenitisprobablyaconceptualclass,notanattribute.StorephoneNumberSaleSalestoreOr 2)ACommonmistakeinadomainmodelAirportnameFlightFlightdestinationOr 24oThinkaboutdescriptionclasseswhencreatinganinitiallistofconceptualclasses(orduringrefactoring):nAdescriptionclasscontainsinformationthatdescribessomethingelse3)WhentoModelwithDescriptionClasses25nAddadescriptionclass(forexample,ProductDescription)when:oThereneedstobeadescriptionaboutanitemorservice,independentofthecurrentexistenceofanyexamplesofthoseitemsorservices.oDeletinginstancesofthingstheydescribe(forexample,Item)resultsinalossofinformationthatneedstobemaintained,butwasincorrectlyassociatedwiththedeletedthing.oItreducesredundantorduplicatedinformation.26oAnotherexample:DescriptionsintheAirlineDomain27oSomeconceptualclasseswillbemissedatthisstage:aimatagoodinitialdomain,notperfection.oUseterminology(e.g.namesofconcepts,descriptionsofusecases)thatmakesenseintheapplicationcontext.oWecanalsomodelun-realworldproblems:E.g.inatelecommunicationdomain:Message,Connection,Port,Dialog,Route,Protocolwouldbecandidateconceptualclasses.Discussion283.AssociationsoAnassociationisarelationshipbetweenclassesthatindicatesomemeaningfulandinterestingrelationshipCriteria for Useful Associations oAssociationsforwhichknowledgeoftherelationshipneedstobepreservedforsomeduration(“need-to-know” association) oSalesLineIteminstancesareassociatedwithaSale ?oaCashierhaslooked-upaparticularProductDescription ?oAssociationsderivedfromtheCommonAssociationList29TheUMLAssociationNotation30oBasedonaClassName-VerbPhrase-ClassNameformatwheretheverbphrasecreatesasequencethatisreadableandmeaningful.NamingAssociations31oEachendofanassociationiscalledarole.Rolesmayoptionallyhave:nmultiplicityexpressionnname(toclarifymeaning)nnavigability(notrelevantduringOOA)oThemultiplicitydefineshowmanyinstancesofaclassAcanbeassociatedwithoneinstanceofaclassB3233oThemultiplicityvaluecommunicateshowmanyinstancescanbevalidlyassociatedwithanother,ataparticularmoment,ratherthanoveraspanoftimenA CarStocked-byoneDealeroAddingmultiplicityvaluestotherolesofanassociationhelpsexploringtheproblemdomain.oTwoclassesmayhavemultipleassociationsbetweentheminaUMLclassdiagram;thisisnotuncommon:34oTwomainways:nwhatneedtoknowassociationsarenecessarygivenourcurrentlistofcandidateconcepts?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 transaction (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 contained 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 subunit of BDepartmentStoreMaintenanceAirline36Continued Association CategoryExamplesA uses or manages or owns BCashier-RegisterPlayer-PiecePilot-AirplaneA is next to BSalesLineItem-SalesLineItemSquare-SquareCity-City37Partial POS Domain Model384.AttributesoAnattributeisalogicaldatavaluesofanobjectoIncludeattributesthattherequirements(forexample,usecases)suggestorimplyaneedtorememberinformationoForexample,areceipt(whichreportstheinformationofasalenormallyincludesadateandtime,thestorenameandaddress,andthecashierID,amongmanyotherthings.Therefore,nSaleneedsadateTimeattribute.nStoreneedsanameandaddress.nCashierneedsanID.39oThefullsyntax:visibility name : type multiplicity = default property-stringoreadOnlyisprobablythemostcommonpropertystringforattributes.Privatevisibility(-)isusuallyimplicit.oAttributemultiplicitycanbeusedtoindicatetheoptionalpresenceofavalue,orthenumberofobjectsthatcanfilla(collection)attribute.40UMLAttributeNotationDerivedAttributesoAnattributethatcanbederivedbyotherinformation.41WhatareSuitableAttributeintheDomainModeloFocus on Data Type Attribute in the Domain Model nTheattributesshouldbe“primitive”datatypesEx.Numbers,Booleans,Date,String,Time,Character,nTheattributes,normally,shouldnotbeacomplexdomainconceptEx.Sale,AirportoAcommonmistakeismodelingacomplexdomainconceptasanattribute4243WhentoDefineNewDataTypeClassesoRepresentwhatmayinitiallybeconsideredanumberorstringasanewdatatypeclassinthedomainmodelif:oItiscomposedofseparatesections.nphonenumber,nameofpersonoThereareoperationsassociatedwithit,suchasparsingorvalidation.nsocialsecuritynumberoIthasotherattributes.npromotionalpricecouldhaveastart(effective)dateandenddateoItisaquantitywithaunit.npaymentamounthasaunitofcurrencyoItisanabstractionofoneormoretypeswithsomeofthesequalities.nitemidentifierinthesalesdomainisageneralizationoftypessuchasUniversalProductCode(UPC)andEuropeanArticleNumber(EAN)44WheretoIllustrateTheseDataTypeClasses?oSinceItemIDisadatatype,itcanbeshownintheattributecompartmentoftheclassboxoIfItemIDisanewtypewithitsownattributesandassociations,itcanbeshownasaconceptualclassinitsownboxoItdependswhatyouwanttoemphasizeinthediagram45NoAttributesRepresentingForeignKeysoAttributesshouldnotbeusedtorelateconceptualclassesinthedomainmodel.oThemostcommonviolationofthisprincipleistoaddakindofforeignkeyattribute46ModelingAttributeQuantitiesandUnits47AttributesintheDomainModels48NextGenPOSDomainModel(withattributes)49oIniterativedevelopment,weincrementallyevolveadomainmodeloverseveraliterations.oIneach,thedomainmodelislimitedtothepriorandcurrentscenariosunderconsideration,ratherthanexpandingtoabigbangwaterfall-stylemodelthatearlyonattemptstocaptureallpossibleconceptualclassesandrelationships.nForexample,thisPOSiterationislimitedtoasimplifiedcash-onlyProcessSalescenario;therefore,apartialdomainmodelwillbecreatedtoreflectjustthatnotmore.5.Process:IterativeandEvolutionaryDomainModelling50oDomainmodelingisaveryimportantactivityinOOA.Wemustensurethatthemodelbuiltwillbeabletowithstandtheinformationrequirementsofthecurrentiteration.oInaddition,themodelwillgrowinsubsequentiterationsaremorerequirementsareexamined.oIdentifyingarichsetofconceptualclassesisattheheartofOOanalysisoDomainModelingisoftencalledBusinessModeling;andisbothstartedandcompletedintheelaborationphase.Conclusions51Chapter10.SystemSequenceDiagramsoObjectivesnIdentifysystemeventsnCreatesystemsequencediagramsforusecasescenarios5253SystemSequenceDiagram(SSD)oTheOOADchallengenUCsarefunctionalbutSystemisOOnThisisamodelingparadigmmismatchnHowtomakethefunctional-OOtransitionoWithoutlosinganyreqsoBeingabletodemonstratenoreqsarelostoEndupwithacorrect,robust&flexibleOOsystemoUltimately,everyreqmustbeanassignedresponsibilityforsomeobject!5455SSDsoSSDsareoneofthebooksbestideasoSSDisthekeymodelthatnLinksUCswithOOmodels(e.g.,class&sequence)nSupportedbyoperationcontracts(nextchp)nEstablishestraceabilityofreqsintoOOmodels5656SSDsoAUCspecifiesfunction-alityoAUCscenarioisatime-orderedseriesoffunctioncallsthatActorinvokesonSystemoLarmancallsthemsystemoperationsorsystemeventsoKeytasksareoIdentifythefunctionsinaUCscenariooTranslatethemintoUMLfunctionsyntaxoDrawasequencediagram(easypart)oEasierifyouhavesimple,completeUCsSystemSequenceDiagram(SSD)oIllustrateinputandoutputeventsrelatedtothesystemunderdiscussionoTheusecasetextanditsimpliedsystemeventsareinputtoSSDcreationoSSDisusedtodescribeaparticularscenarioofausecasenmainsuccessscenarionfrequentorcomplexalternativescenariooForeachsystemevents,thereisasystemoperation(1to1)oTheSSDoperationsncanbeanalyzedintheoperationcontractsnDetailedintheGlossarynServeasthestartingpointfordesigningcollaborationobjects57SSDforaProcessSaleScenario58SSDsarederivedfromusecases;theyshowonescenario5960ProcessSaleUCUC: Process Sale makeNewSale()1.User selects new sale option (Request-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 finished 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 receiptChooseeventandoperationnamesatanabstractlevel61Process:IterativeandEvolutionarySSDsoDontcreateSSDsforallscenarios,drawthemonlyforthescenarioschosenforthenextiterationoSSDsarepartoftheUse-Case,notexplicitlymentionedintheoriginalUPoMostSSDsarecreatedduringelaboration,whenitisusefultoidentifythedetailsofthesystemeventstoclarifywhatmajoroperationsthesystemmustbedesignedtohandle,writesystemoperationcontracts,andpossiblytosupportestimation62Chapter11.OperationContractsoObjectivesnDefinesystemoperations.nCreatecontractsforsystemoperations6364WhatisaSystemOperation?65OperationContractsodescribedetailedsystembehaviorintermsofstatechangestoobjectsintheDomainmodel,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-conditions?oThinkaboutyourdomainmodelnIdentifiesobjects(+attributes)andassociationsoTheOClinksasystemoperationtospecificobjectsinthedomainmodeloIndicateswhichobjectsareaffectedbytheoperationoWillhelpwithassignmentofresponsibilities69PostconditionsoThepostconditionsdescribechangesinthestateofobjectsintheDomainModel.oDomainModelstatechangesincludeninstancescreatednassociationsformedorbrokennattributeschanged70oExample enterItem Postconditions nASalesLineIteminstancesliwascreated(instancecreation)nsli.quantitybecamequantity(attributemodification)nsliwasassociatedwiththecurrentSale(associationformed)nsliwasassociatedwithaProductSpecification,basedonItemIDmatch(associationformed)71WhenAreContractsUseful?oTheusecasearethemainrepositoryofrequirementsfortheprojectoContractsareneededonlywherethedetailsandcomplexityofrequiredstatechangesareawkwardtocaptureinusecases72HowtoCreateandWriteContracts?oIdentifysystemoperationsfromSSDsoForsystemoperationsthatarecomplexandperhapssubtleintheirresults,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
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号