版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1SE3121021:SoftwareArchitecture
SoftwareArchitectureStyle
2SoftwareArchitectureStyle:Call/Return
调用/返回
3Call/Return的不同种类Mainprogramandsubroutines主程序和子程序Classicalprogrammingparadigm-functionaldecompositionObject-Oriented/AbstractDataTypesInformation(representation,accessmethod)hidingLayeredhierarchiesEachlevelonlycommunicateswithitsimmediateneighborsOtherClient/Server……4HistoryMainprogramandsubroutines单线程控制,划分为若干处理步骤Functionalmodules把处理步骤集成到模块内AbstractDataTypes操作和数据捆绑在一起,隐藏具体实现Objects方法(动态绑定),多态(子类),重用(继承)OOArchitectures对象活动在不同的进程/线程Client/Server,tieredstylesComponents多个接口,二进制兼容,中间件也是编程语言的发展历程5MainProgramandSubroutine思考:此图为有向图,是否可能出现环?6MainProgramandSubroutineProblem:Thispatternissuitableforapplicationsinwhichthecomputationcanappropriatelybedefinedviaahierarchyofproceduredefinitions.存在层次结构Context:Manyprogramminglanguagesprovidenaturalsupportfordefiningnestedcollectionsofprocedures(过程的嵌套)andforcallingthemhierarchically.Theselanguagesoftenallowcollectionsofprocedurestobegroupedintomodules,therebyintroducingname-spacelocality.Theexecutionenvironmentusuallyprovidesasinglethreadofcontrolinasinglenamespace.Solution:Systemmodel:callanddefinitionhierarchy,subsystemsoftendefinedviamodularityComponents:proceduresandexplicitlyvisibledataConnectors:procedurecallsandexplicitdatasharingControlstructure:singlethread7MainProgramandSubroutine:ModelHierarchicaldecomposition:Basedondefinition-userelationshipUsesprocedurecallasinteractionmechanismSinglethreadofcontrol:SupporteddirectlybyprogramminglanguagesHierarchicalreasoning:Correctnessofasubroutinedependsonthecorrectnessofthesubroutinesitcalls。这里有递归的含义Subsystemstructureimplicit:Subroutinestypicallyaggregatedintomodules8MainProgramandSubroutine9PipesvsProceduresPipesProceduresControlAsynchronous异步,data-drivenSynchronous同步,blockingSemanticsFunctionalHierarchicalDataStreamedParameter/returnvalueVariationsBuffering,end-of-filebehaviorBindingtime,exceptionhandling,polymorphism函数式编程命令式编程10CriteriaforModularizationWhatisamodule?Commonview:apieceofcode.Buttoolimited.Compilationunit,includingrelateddeclarationsandinterfaceWhymodularizeasystem,anyway?Management:PartitiontheoveralldevelopmenteffortdivideandconquerEvolution:DecouplepartsofasystemsothatchangestoonepartareisolatedfromchangestootherpartsUnderstanding:Permitsystemtobeunderstoodascompositionofmind-sizedchunksKeyissue:whatcriteriatouseformodularization11ModuleDecompositionParnasHidesecrets.OK,what’sa“secret”?RepresentationofdataPropertiesofadevice,otherthanrequiredpropertiesTrytolocalizefuturechangeHidesystemdetailslikelytochangeindependentlyExposeininterfacesassumptionsunlikelytochangeUsefunctionstoallowforchangeThey’reeasiertochangethanvisiblerepresentation隐藏“会变”的,暴露“不变”的12Encapsulation/InformationHidingParnas:Hidesecrets(notjustrepresentations)Booch:Object’sbehaviorischaracterizedbyactionsthat
itsuffersandthatitrequiresPracticallyspeaking:Objecthasstateandoperations,butalsohasresponsibilityfortheintegrityofitsstate(state相当于内部数据成员)ObjectisknownbyitsinterfaceObjectisprobablyinstantiatedfromatemplate(类)Objecthasoperationstoaccessandalterstateandperhapsgenerator(构造函数)Therearedifferentkindsofobjects(e.g.,actor,agent,server)13Object-Oriented14DataAbstractionorObject-OrientedProblem:Thispatternissuitableforapplicationsinwhichacentralissueisidentifyingandprotectingrelatedbodiesofinformation,especiallyrepresentationinformation。OO是对现实中离散事件和个体交互的仿真,最适合模拟现实。Context:Numerousdesignmethodsprovidestrategiesforidentifyingnaturalobjects.Newerprogramminglanguagessupportvariousvariationsonthetheme,soifthelanguagechoiceorthemethodologyisfixed,thatwillstronglyinfluencetheflavorofthedecomposition.Solution:Systemmodel:localizedstatemaintenanceComponents:managers(e.g.,servers,objects,abstractdatatypes)Connectors:procedurecallControlstructure:decentralized,usuallysinglethread15ElementsofObjectArchitecturesEncapsulation:Restrictaccesstocertaininformation
封装:限制对某些信息的访问Interaction:Viaprocedurecallsorsimilarprotocol
交互:通过过程调用或类似的协议Polymorphism:Choosethemethodatrun-time
多态:在运行时选择具体的操作Inheritance:Shareddefinitionsoffunctionality
继承:对共享的功能保持唯一的接口Reuseandmaintenance:Exploitencapsulationandlocalitytoincreaseproductivity
复用和维护:利用封装和聚合提高生产力严重依赖于具体使用的语言16ProblemswithObjectApproachesManagingmanyobjectsvastseaofobjectsrequiresadditionalstructuring
大量对象需要额外的结构来容纳hierarchicaldesignsuggestedbyBoochandParnasManagingmanyinteractionssingleinterfacecanbelimiting&unwieldy(hence,“friends”)
只提供单一的接口不灵活(于是,“友元”)somelanguages/systemspermitmultipleinterfaces(innerclass,interface,multipleinheritance)DistributedresponsibilityforbehaviormakessystemhardtounderstandinteractiondiagramsnowusedindesignCapturingfamiliesofrelateddesignstypes/classesareoftennotenough类图无法表示运行时内存状态designpatterns作为解决此问题的一个分支17ManagingLargeObjectSetsPureO-OdesignleadstolargeflatsystemswithmanyobjectsSameoldproblemscanreappearHundredsofmodules=>hardtofindthingsNeedawaytoimposestructureNeedadditionalstructureanddisciplineStructuringoptionsLayers(whicharenotnecessarilyobjects)SupplementalindexHierarchicaldecomposition:bigobjectsandlittleobjects18StylisticVariationsClient-serverObjectsareprocesses
进程就是对象Asymmetric:clientknowsaboutservers,butnotviceversa
不对称:客户端知道服务器,反之则不然TieredElaborationonclient-server
C/S模式的扩展Aggregationintorun-timestrata
运行时层的结合Usuallysmallnumberoftiers
通常只有少量的层Components(later)MultipleinterfacesSpecialprotocolsfordynamicreconfiguration
支持动态配置的专门协议19Layeredsystem无处不在的层次结构硬件OS应用应用应用平台20OSI参考模型2122ThelayeredarchitecturalpatternProblem:Thispatternissuitableforapplicationsthatinvolvedistinctclassesofservicesthatcanbearrangedhierarchically.Oftentherearelayersforbasicsystem-levelservices,forutilitiesappropriatetomanyapplications,andforspecifictasksoftheapplication.Context:Frequently,eachclassofserviceisassignedtoalayerandseveraldifferentpatternsareusedtorefinethevariouslayers.Layersaremostoftenusedatthehigherlevelsofdesign,usingdifferentpatternstorefinethelayers.Solution:Systemmodel:hierarchyofopaque(不透明的)layersComponents:usuallycomposites;compositesaremostoftencollectionsofproceduresConnectors:dependsonstructureofcomponents;oftenprocedurecallsunderrestrictedvisibility,mightalsobeclient/serverControlstructure:singlethread23Thelayeredarchitecturalpattern24层次风格特点每层为上一层提供服务,使用下一层的服务,只能见到与自己邻接的层适当时候(迫不得已时),可以允许一定的越层操作大的问题分解为若干个渐进的小问题,逐步解决,隐藏了很多复杂度修改一层,最多影响两层,而通常只能影响上层。若层之间接口稳固,则不会造成其他影响上层必须知道下层的身份,不能调整层次之间的顺序层层相调,影响性能25TheMiddlewareViewMainfeaturestieredsystemfactorout50%-90%ofapplicationindependentcodeintosharedservicesbuildonexistingtransport/communicationinfrastructureApplicationsCommonApplicationServicesCommonTransportServicesinvokes26Client/Server
服务器客户客户客户客户客户LocalLoopback27Client/ServerStyle两层C/S结构三层C/S结构B/S结构(浏览器/服务器风格)28两层Client/ServerWorkstations包含显示层与业务层,Server只有数据29两层Client/ServerC/S是基于资源不对等,且为实现共享而提出的,20世纪90年代成熟起来C/S有三个主要组成部分:数据库服务器、客户端和网络服务器(后台)负责数据管理,客户端(前台)完成与用户的交互任务。“胖客户端,瘦服务器”缺点:对客户端软硬件配置要求较高,客户端臃肿客户端程序设计复杂数据安全性不好。客户端程序可以直接访问数据库服务器。信息内容和形式单一用户界面风格不一,使用繁杂,不利用推广使用软件维护与升级困难。每个客户机上的软件都需要维护30三层Client/ServerClient-Application-Server与二层C/S结构相比,增加了一个应用服务器。整个应用逻辑驻留在应用服务器上,只有表示层存在于客户机上(“瘦客户端”)应用功能分为表示层、功能层、数据层三层表示层是应用的用户接口部分。通常使用图形用户界面功能层是应用的主体,实现具体的业务处理逻辑数据层是数据库管理系统。以上三层逻辑上独立。通常只有表示层配置在客户端中思考:“瘦客户端”的三层C/S有何优缺点?3132Client-Application-Server…33B/SB/S是三层C/S的特例客户端为http浏览器为增强功能,往往还需要安装flash、jvm及一些专用插件使用标准http/https协议要考虑浏览器兼容的问题通常只能“拉”,不能“推”客户之间的通信只能通过服务器中转安全性较难控制(SQL注入攻击等)数据查询等响应速度低于C/S体系结构服务器的负荷大,客户机的资源浪费用RIA等技术解决,主流浏览器也对硬件逐步利用到底应把主要的计算量放到客户机还是服务器?34SoftwareArchitectureStyle:
DataCentered/SharedData
3536SharedInformationSystemsStylerepresentsalargevarietyofsystems
这种风格描绘很多种系统manyvariantsdependingonnatureofshareddata
共同特点是共享数据Styleaddressesmechanismsfor:collecting,manipulatingandpreservinglargebodiesofdata
收集、操作、存储大量的数据Databasesareanaturalexample,butnottheonlyone
数据库是一个典型的例子37SharedInformationSystemsHighlevelviewwhataretheapparentfeaturesofthisstyle?whataresomeissuesregardingthisstyle?
星型结构简化了拓扑38★SharedInformationSystemsAdvantageseasytoaddconsumersandproducersofdata
很容易增加数据的生产者和消费者Howaboutmodifier?Issuessynchronization(同步)configurationandschemamanagement(配置和管理)atomicity(原子性)consistency(一致性)persistence(持久性)performance(性能)39SharedInformationSystemsLineageEarliestrepositoriesappearinbatchsequentialsystems
早期的数据共享出现在批处理系统mainframes,drums,magnetictapes,discdrivesresourcesmanuallymanagedPressureforon-lineaccesstodata
迫切需要数据即时存取requirementtomakeaccesstodataeasyandinstanthelptodrivetheshiftfrombatch-sequentialtointeractiveprocessingTodaysharedinformationsystemsappeareverywherefromthesmallestbusiness,tothemostadvancedscientificapplicationsmanyapplicationsprovideaccessmechanismstoshareddatatheWebhasbecomeagiantdistributedrepository40EvolutionofSharedInformationSystemsBatchSequentialSystemsflatfileaccess(I/O)41EvolutionofSharedInformationSystemsDatapool(SharedMemory)Example:EnabledbyavailabilityofRAMandlanguagestopermitthesharingofcommondata(E.g.,FORTRANCOMMONBLOCK)ProcessesarenotnecessarilysequentialGetsmessywithoutimplementationrules-whataretheissues?42RepositoryArchitecture除数据库外,剪贴板、注册表是典型的仓库风格的例子43EvolvingDatabaseArchitecturesBatchprocessing:Standaloneprograms(独立的程序)resultswerepassedfromonetoanotheronmag-tape(结果通过磁带从一个程序传到另一个程序)batchsequentialmodel(批处理模式)Interactiveprocessing:concurrentoperationandfasterupdatesprecludebatching,soupdatesareoutofsynchwithreports.
并行操作、更快的更新速度,但是使更新难以保持和报告同步。Repositorymodelwithexternalcontrol(仓库风格)现状:信息分散在很多数据库中问题:想买本书,如何了解哪个网站最便宜?4445UnifiedSchemasforIntegratingDatabasesAbstraction:multiplexthedatabases;put
filtersonthequery/updateto
matchdiverseviews集成多个数据库;
在查询/更新操作中
增加过滤器/包装器来匹配
不同的视图难点:查询分解、结果合并46Multi-databases47ComputerAidedSoftware
EngineeringInitiallyjusttranslationfromsourcetoobjectcode:compiler,library,linker,make
起初,就是做从源代码到目标代码的转换Grewtoincludedesignrecord,documentation,analysis,configurationcontrol,incrementality
开始包含分析、设计、调试、测试、文档、配置管理、增量编译等功能Integrationdemandedfor20years,butnothereyet.
集成已经作了20年,但还没有结束48CASEvs.DBMSAscomparedtodatabases,CASEhas:moretypesofdata
更多的数据类型fewerinstancesofeachtype
更少的数据类型实例slowerqueryrates
更慢的查询频率larger,morecomplex,lessdiscreteinformation
更大,更复杂,更集中的信息butnotshorterlifetime
生命周期没有更短49TraditionalCompiler50Example:ModernCanonicalCompiler51CanonicalCompiler52SoftwareToolswithSharedRepresentation53EvolutionofCASEEnvironmentsEvolutionismuchlikedatabases:Interaction:batch-->interactive
交互:批处理交互式Granularity:completeprocessing-->incremental
粒度:完全处理增量Coverage:compilation-->fulllifecycle
覆盖:编译全生命周期Likedatabases,startedwithbatchsequentialstyle
从批处理风格开始Integrationneedsledtorepositorieswithrigidcontrol,thentoopensystemsinlayers
对集成性的要求,促成了仓库风格被应用,让系统开始分层54RepositoryProblem:Thispatternissuitableforapplications
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 服务升级客户合同(2篇)
- 2025至2031年中国软瓣止回阀行业投资前景及策略咨询研究报告
- 2025至2031年中国燃气烧嘴行业投资前景及策略咨询研究报告
- 2025至2031年中国双抛物线格栅灯行业投资前景及策略咨询研究报告
- 2025年度旅游行业高级管理人才引进合同
- 2025年度税务局查账财务清算合同
- 2025年度智能新能源汽车合作协议转让股份合同模板
- 二零二五年度合同主体变更补充协议的履行与变更
- 二零二五年度茶楼转让及茶艺养生馆合作合同范本:茶楼与茶艺养生馆合作转让协议
- 二零二五年度行政事业单位国有房屋租赁合同(安全风险评估)
- 2025年度高端商务车辆聘用司机劳动合同模板(专业版)4篇
- GB/T 45107-2024表土剥离及其再利用技术要求
- 2025长江航道工程局招聘101人历年高频重点提升(共500题)附带答案详解
- 2025年黑龙江哈尔滨市面向社会招聘社区工作者1598人历年高频重点提升(共500题)附带答案详解
- 《妊娠期恶心呕吐及妊娠剧吐管理指南(2024年)》解读
- 【独家揭秘】2024年企业微信年费全解析:9大行业收费标准一览
- 1-1 拥抱梦想:就这样埋下一颗种子【2022中考作文最热8主题押题24道 构思点拨+范文点评】
- 职业暴露与防护
- 酒店行业客源渠道分析
- AVL-CRUISE-2019-整车经济性动力性分析操作指导书
- 肠道医学解剖和生理学
评论
0/150
提交评论