仓酷云

标题: ASP.NET教程之怎样在vs.net中使用UML来建模(转自MSDN... [打印本页]

作者: 山那边是海    时间: 2015-1-16 22:50
标题: ASP.NET教程之怎样在vs.net中使用UML来建模(转自MSDN...
今天去面试,被问到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]
也不知道,我同学昨天说数据挖掘很好。
作者: 简单生活    时间: 2015-1-20 05:33
ASP在执行的时候,是由IIS调用程序引擎,解释执行嵌在HTML中的ASP代码,最终将结果和原来的HTML一同送往客户端。
作者: 精灵巫婆    时间: 2015-1-25 18:19
由于CGI程序每响应一个客户就会打开一个新的进程,所以,当有多个用户同时进行CGI请求的时候,服务器就会打开多个进程,这样就加重了服务器的负担,使服务器的执行效率变得越来越低下。
作者: 分手快乐    时间: 2015-2-3 12:46
但是目前在CGI中使用的最为广泛的是Perl语言。所以,狭义上所指的CGI程序一般都是指Perl程序,一般CGI程序的后缀都是.pl或者.cgi。
作者: 若天明    时间: 2015-2-9 01:24
ASP(ActiveServerPages)是Microsfot公司1996年11月推出的WEB应用程序开发技术,它既不是一种程序语言,也不是一种开发工具,而是一种技术框架,不须使用微软的产品就能编写它的代码。
作者: 蒙在股里    时间: 2015-2-26 17:04
比如封装性、继承性、多态性等等,这就解决了刚才谈到的ASP的那些弱点。封装性使得代码逻辑清晰,易于管理,并且应用到ASP.Net上就可以使业务逻辑和Html页面分离,这样无论页面原型如何改变。
作者: 透明    时间: 2015-3-8 16:14
可以通过在现有ASP应用程序中逐渐添加ASP.NET功能,随时增强ASP应用程序的功能。ASP.NET是一个已编译的、基于.NET的环境,可以用任何与.NET兼容的语言(包括VisualBasic.NET、C#和JScript.NET.)创作应用程序。另外,任何ASP.NET应用程序都可以使用整个.NETFramework。开发人员可以方便地获得这些技术的优点,其中包括托管的公共语言运行库环境、类型安全、继承等等。
作者: 灵魂腐蚀    时间: 2015-3-16 04:32
通过这次激烈的讨论,我从大家身上学到了太多,开阔了眼界,不管是支持我的还是骂我的,都感谢你们。
作者: 海妖    时间: 2015-3-22 20:11
虽然在形式上JSP和ASP或PHP看上去很相似——都可以被内嵌在HTML代码中。但是,它的执行方式和ASP或PHP完全不同。在JSP被执行的时候,JSP文件被JSP解释器(JSPParser)转换成Servlet代码,然后Servlet代码被Java编译器编译成.class字节文件,这样就由生成的Servlet来对客户端应答。所以,JSP可以看做是Servlet的脚本语言(ScriptLanguage)版。
作者: 第二个灵魂    时间: 2015-3-22 20:11
网页从开始简单的hmtl到复杂的服务语言,走过了10多个年头,各种技术层出不穷,单个的主流技术也在不断翻新的版本,现在分析下各种语言的区别、优势、劣势、开发注意事项!




欢迎光临 仓酷云 (http://ckuyun.com/) Powered by Discuz! X3.2