|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
今天去面试,被问到C#中的new关键字,看了那么多的书对new关键字还是有一定认识,回来又把new复习了一遍,发现了许多以前还不知道的细节。VisuallyModelSoftwareApplications
Note:SomefeaturesmaynotbeofferedinthepubliclyavailableVisualStudio.NETBeta2.
Customersbuildingcomplexdistributedapplicationsfacethechallengeofsuccessfullycommunicatingapplicationarchitectureandrequirementsacrossabroadrangeofteammembers.ThischallengecompoundsaswemoveintotheworldoflooselycoupledXMLWebservices.Itiscommonknowledgethatthepresentationofconceptsandinformationinmultipleformats―visual,spoken,written―enhancespeoplesabilitytounderstandmessagesquicklyandaccurately.Takingthismultiple-formatapproachtocommunicating,VisualStudio.NEThelpsfosterteamcoordinationandproductivitybyprovidingarichsetofvisualmodelingtoolsforspecifyingapplicationarchitectureandrequirements.
AnIndustry-StandardApproach
VisualStudio.NETdeliverssupportforafullrangeofdesignandmodelingactivities,includingfreeformdiagrammingcapabilitiesaswellasasetofindustry-standardUnifiedModelingLanguage(UML)diagrams.UMLisanotationforvisuallydescribingandinterpretingthepieces,relationships,andactionsthatcompriseasoftwareapplication.
WiththeVisualStudio.NETmodelingfeatures,userscancreatesophisticateddiagramstospecifytheirapplicationarchitectureandbusinessrequirements,andcancommunicatetheseacrosstheirteams.Businessanalysts,architects,developers―andotherswhowanttoperformanalysisanddesigntaskstoenhancecommunicationandincreasetheproductivityoftheirdevelopmentteams―cantakeadvantageofthesenewcapabilities.ThefollowingscenariodemonstrateshowthestructureofaparticularsoftwaresystemcanbevisualizedandmoreeffectivelycommunicatedbyusingsoftwaremodelscreatedinVisualStudio.NET.
ApplicationScenario:ACarRentalSoftwareSystem
ThisscenariodiscusseshowtheeightUMLdiagramtypesmightbeusedtomodelacarrentalagencyssoftwaresystem.Beginningwiththreesimpleusecases,theexamplescapturethecoreprocessesinthesystem.
UseCaseDiagram
Ausecasespecifiesaninteractionbetweenauserandthesysteminwhichtheuserisabletoachieveagoal.Atypicalsoftwaresystemmightincludehundredsofsimpleusecases.Someusecasesapplicabletotherentalagencyssystemare:
Customerreservescar
Beforeobtainingacar,acustomermustmakeareservation.Thecustomercontactstherentalagencyandmakesarequest.Theagencyacceptsordeclinestherequestbasedonanumberofcriteria,suchastheavailabilityofcarsorthecustomersrentalhistory.Ifthereservationisaccepted,theagencycompletesaformcontainingcustomerdetails.Paymentofadepositcompletesthereservation.
Customerpicksupcar
Whenthecustomerarrivesattheagency,therentalagencyallocatesthemodelofcarrequestedbythecustomer,dependingoncurrentstocklevels.Afterpayingthefullfee,thecustomerreceivesthecar.
Customerreturnscar
Thecustomerreturnsthecartotheagencyonthedayspecifiedintherentalagreement.
Thefollowingimagedepictstheuse-casediagramforthesethreeusecases.
Figure1.Asimpleusecasediagram
StaticStructure(Class)Diagram
Thenexttaskistoclassifytheobjectsinvolvedandtheirrelationships.Examiningusecaseshelpsidentifyclasses.Classesofobjectsaremodeledusingstaticstructure,orclass,diagramsthatshowtheoverallstructureofthesystem,aswellasrelationalandbehavioralproperties.
Inaclassdiagram,theobjectsinvolvedinthecarrentalsystemaregroupedintoclasses.Eachclasscontainsanamesectionandanattributesection.Someclassesalsoincludeanoperationssection,whichspecifieshowobjectswithinthatclassmaybehave.
IntheCustomerclass,attributesincludename,telephonenumber,driverslicensenumber,andaddress.Thedateofbirthisrequiredtodeterminethatthecustomermeetstheminimumagerequirementtorentavehicle.TheCustomerclassalsostoresoperations,suchasreservations.
Classdiagramssupportinheritance.Inthefollowingfigure,forexample,theMechanicandRentalAgentclassesinheritattributes,suchasnameandaddress,fromtheEmployeeclass.
Figure2.Astaticstructure,orclass,diagram
SequenceDiagram
Asequencediagramprovidesadetailedviewofausecase.Itshowsaninteractionarrangedinasequenceovertime,andhelpstodocumenttheflowoflogicwithintheapplication.Theparticipantsareshowninthecontextofthemessagesthatpassbetweenthem.Inacomprehensivesoftwaresystem,thesequencediagramcanbequitedetailed,andcanincludethousandsofmessages.
Supposethatacustomerwantstoreserveacar.Therentalagentmustfirstcheckthecustomersrecordstoensurethatthecustomermaydoso.Ifthecustomerhasrentedacarfromthecompanybefore,hisorherrentalhistorywillalreadyberecorded,andtheagentneedonlyensurethatallprevioustransactionsransmoothly.Forexample,theagentcanconfirmthatthecustomerspreviousrentalcarswerereturnedontime.Oncethecustomersrentalstatusisapproved,therentalagentcanapprovethecarrentalreservation.Thisprocesscanberepresentedinasequencediagram,asshowninthefigurebelow.
Figure3.Asequencediagram
CollaborationDiagram
Acollaborationdiagramisanothertypeofinteractiondiagram.Likeasequencediagram,itshowshowagroupofobjectsinausecaseworkwithoneanother.Eachmessageisnumberedtodocumenttheorderinwhichitoccurs.
Figure4.Acollaborationdiagram
StatechartDiagram
Anobjectsstateisdefinedasitsattributesataparticularmoment.Objectsmovethroughvariousstatesastheyareinfluencedbyoutsidestimuli.Thestatechartdiagrammapsthesestates,aswellasthetriggeringeventsthatcausetheobjecttobeinaparticularstate.Forexample,inourrentalsystem,theobjectisacar.Asacarmovesthroughtherentalsystem,itsmanystatesproduceacomplexbutilluminatingdiagram.Forexample,itisfirstaddedtothefleet.ItremainsinthestateInStockuntilitisrented.Afterrenting,thecarisreturnedtothefleetandtotheInStockstate.Atvarioustimesinitscommerciallife,thecarmayrequirerepairs(InService).Whenthecarreachestheendofitsusefulness,itiseithersoldorscrappedtomakewayforanewvehicle.
Figure5.Astatechartdiagram
ActivityDiagram
Anactivitydiagramdisplaysthelogicthatoccursinresponsetointernallygeneratedactions.Anactivitydiagramrelatestoaspecificclassorusecase,andshowsthestepsinvolvedincarryingoutaparticularoperation.
Figure6.Anactivitydiagram
ComponentDiagram
Acomponentdiagramshowshowvarioussoftwaresubsystemsmakeuptheoverallstructureofthesystem,whichisbuiltonacentralizeddatabasethatcontainspastrentalrecords,cardetails,servicerecords,andcustomerandemployeedetails.Itiscriticalthatthisdatabecentralizedinonedatabase,becausestocklevelsvarybythehourandallpartiesmusthaveup-to-theminuteinformation.Keepingthedatacurrentrequiresreal-timeinformationupdatesbyallparties.ThesoftwaresubsystemsforthisexampleincludeCarRecords,ServiceRecords,SalesRecords,CustomerRecords,andEmployeeRecords.
Figure7.Acomponentdiagram
DeploymentDiagram
Adeploymentdiagramshowshowthehardwareandsoftwareinthesystemareconfigured.Therentalagencyneedsaclient/serversystemwithacentraldatabaseofrecordsthatthestaffcanaccess.Rentalagentsneedaccesstothedataonvehicleavailability.Meanwhile,mechanicsneedtobeabletoflagaparticularcarasbeingintheInServicestate.
Figure8.Adeploymentdiagram
FreeformModeling
ManycustomersalsowanttheabilitytoaddothergraphicalelementstotheUMLdiagramsintheirapplicationmodels.VisualStudio.NETenablesfreeformmodeling,suchasflowchartsandothernon-semanticdiagrams,aswellastheabilitytoembedanyimagewithinamodel.Thisprovidescustomerswithadditionalflexibilityincommunicatingtheirapplicationarchitectureandfunctionality.
Summary
Duringtheapplicationlifecycle,manypeopleofvaryingtechnicalbackgroundsneedtointeractandcommunicatetosuccessfullyaccomplishthecommongoalofcreatinganewapplication.VisualStudio.NETprovideskeyfeatures―industrystandardsoftwaremodelingandrichfreeformdiagrammingcapabilities―forspecifyingandcommunicatingarchitecture.Customerswhousethesefeatureswillbenefitthroughmoreeffectivecommunicationwithintheirdevelopmentteams,whichwillincreasetheefficiencyofdevelopersandthesuccessrateofsoftwareprojectsintheirorganizations.
[img=1border=0style=,1src=]http://www.ckuyun.com/[/img]
也不知道,我同学昨天说数据挖掘很好。 |
|