软件设计课件.ppt

上传人(卖家):三亚风情 文档编号:2604297 上传时间:2022-05-10 格式:PPT 页数:136 大小:2.14MB
下载 相关 举报
软件设计课件.ppt_第1页
第1页 / 共136页
软件设计课件.ppt_第2页
第2页 / 共136页
软件设计课件.ppt_第3页
第3页 / 共136页
软件设计课件.ppt_第4页
第4页 / 共136页
软件设计课件.ppt_第5页
第5页 / 共136页
点击查看更多>>
资源描述

1、软件设计内容概要内容概要软件设计的基本概念面向对象设计及UML软件体系结构设计Usecase设计用户界面设计基本概念基本概念软件设计的定义软件设计的重要性软件设计的目标软件设计的基本原则Design for ChangeDesign for Reuse软件设计的定义软件设计的定义1.The process of defining the architecture, components, interfaces, and other characteristics of a system or component.2.The results of that process.IEEE Standa

2、rd Glossary of Software Engineering Terminology, IEEE std 1990.软件设计的重要性软件设计的重要性“怎么做”需求分析:“做什么”软件实现的基础和依据影响软件测试及维护的难易提供了软件的表示,使软件质量评价成为可能软件设计的目标软件设计的目标设计必须实现分析模型中描述的所有显式需求,必须满足用户希望的所有隐式需求。设计必须是可读、可理解的,使得将来易于编程、易于测试、易于维护。设计应从实现角度出发,给出与数据、功能、行为相关的软件全貌。 “There are two ways of constructing a software des

3、ign: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult. ” C. A. R. CoareKISS:Keep It Simple, Student简单化是一种美德软件设计的基本原则软件设计的基本原则软件设计的基本原则软件设计的基本原则Design

4、 for Change信息隐蔽抽象化自顶向下,逐步细化模块化Design for Reuse复用的基本概念基于构件的软件开发Design for changeWhy?变化是不可避免的,变化是可以预期的How?识别并隔离可能变化的区域设计可以隔离变化的接口信息隐蔽信息隐蔽每个模块的实现细节对于其他模块来说是隐藏的,即模块中所包含的信息(包括数据和过程)不允许其他不需要这些信息的模块使用。public void foo () Vector vt = new Vector (); vt.add (“Hello”); vt.add (0, new Integer (1); System.out.pri

5、ntln (“The size is: ” +vt.capacity (); vt.remove (0); vt.clear ();抽象化抽象化过程抽象层次I:用问题所处环境的术语来描述软件层次II:任务需求的描述层次III:程序过程表示数据抽象在不同层次上描述数据的细节控制抽象包含程序控制机制而无须规定其内部细节自顶向下,逐步细化自顶向下,逐步细化对软件系统体系结构中,各个层次的过程描述和数据描述逐步细化,直到可以用程序设计语言实现为止“顶”:概念性的描述“底”:实现的细节与“抽象”的过程相对应模块化模块化将整个软件分成若干可单独命名和编址的部分,称之为模块好处降低复杂度提高软件的可维护性和

6、对于变化的灵活性有助于各个功能并行地开发、测试,提高生产率提高软件的可理解性有利于软件的复用(设计复用、代码复用)Trade-offs将大而复杂的问题分解成容易处理的小问题,可降低复杂性,减少工作量E (P) E (P1) + E (P2) 小问题不独立,则相互作用可能增加工作量E (P1+I1*P1) + E (P2+I2*P2) E (P1) + E (P2)“分解问题”增加工作量E (P1+I1*P1) + E (P2+I2*P2) + E (D)结论:粒度,数量模块粒度减小 模块内结构简单单个模块的工作量减小模块数量增多 模块间联系复杂模块分解及集成的工作量增大存在一个模块数M,使总代

7、价最小软件总成本集成成本成本/模块模块数量成本或工作量最小成本区域M模块化模块化-模块独立性(模块独立性( Independence)软件系统中每个模块只涉及软件要求的具体的子功能,而和其他的模块的接口简单度量准则耦合性(Coupling)内聚性(Cohesion)模块耦合性( Coupling)程序结构中各个模块之间相互关联地度量接口的复杂程度、调用方式、交互的信息1. 非直接耦合:模块之间没有直接关系,它们之间的联系是通过主模块的控制和调用来实现的。public class mainClass () public static void main (String s) Frame fr1

8、= new Frame (); Frame fr2 = new Frame (); 非直接耦合实例非直接耦合实例public class mainClass () public static void main (String s) Frame fr1 = new Frame (); fr1.setTitle (“Vending Machine”); 数据耦合实例数据耦合实例2. 数据耦合: 模块之间通过传递简单数据变量(不是控制参数、公共数据结构或外部变量)交换信息优点:松散耦合,独立性强。public class mainClass () public static void main (

9、String s) MenuBar mb = new MenuBar (); Frame fr1 = new Frame (); fr1.setMenuBar (mb); 标记耦合实例标记耦合实例3. 标记耦合:模块之间通过传递数据结构交换信息。问题:参与模块需清楚数据结构,数据结构的改变导致所有相关模块的更改。4. 控制耦合:一个模块通过传送控制信息,可选择另一模块的功能。 问题:主控模块需了解被控模块的内部逻辑关系,对被控模块的修改会影响主控模块。public class msgBoard extends Panel () public showMsg (String msg, boole

10、an isAdm) StringBuffer bmsg = new StringBuffer ();if (isAdm) bmsg.append (“Hello Administrator: ”);else bmsg.append (“Hello customer: ”);bmsg.append (msg); 控制耦合实例控制耦合实例5. 外部耦合:模块之间共享全局简单变量。问题:容易引起“涟漪效应”缺乏对数据访问的控制模块与全局数据绑定实例:C语言程序中的extern对外界环境的依赖,如I/O设备,数据库,操作系统,网络协议等NOTE:逻辑关系,无物理依赖public static void

11、 main(String args) String url = jdbc:odbc:myDB; try Class.forName(sun.jdbc.odbc.JdbcOdbcDriver); try con = DriverManager.getConnection(url, Admin, duke1); 外部耦合实例外部耦合实例6. 公共耦合:模块之间共享公共数据环境。(全局数据结构、共享通信区。物理结构)问题:模块之间及模块与数据之间的依赖性强。D1D2DnM1M2Mm公共耦合的复杂程度随耦合模块个数的增加而显著增加例如:假设有M个模块,N个数据,任意模块可以访问任意数据,则共有关联关系

12、: M * (M-1) * N7. 内容耦合:一个模块可以直接改变另一模块的数据流或控制流。1)一个模块直接访问另一个模块的内部数据;2)一个模块不通过正常入口转到另一模块内部;3)两个模块有一部分程序代码重叠;4)一个模块有多个入口。模块内聚性( Cohesion)模块功能强度模块内部各个元素彼此结合的紧密程度的度量1. 功能内聚:模块中的各部分都是完成某一具体功能必不可少的组成部分所有部分都为了完成一个具体功能而协同工作,紧密联系,不可分割各部分若分开则导致模块间很强的耦合性2. 信息内聚:模块完成多种功能各个功能在同一数据结构上操作每一项功能有一个唯一的入口点多个功能内聚模块的组合信息隐

13、蔽:将某个数据结构、资源或设备隐藏在一个模块内3. 通信内聚:模块内各功能都使用了相同的输入数据,或产生了相同的输出数据通过数据流图定义4. 过程内聚:模块内的处理是相关的,且必须以特定次序执行例如:错误判定及错误处理5. 时间内聚:模块的各个功能的执行与时间有关,所有功能必须在同一时间段内执行例如:模块初始化、终止6. 逻辑内聚:把相关功能组合在一起,每次调用时,由传送给模块的判定参数来确定模块应执行哪一种功能7. 巧合内聚:模块内个部分之间没有联系,或者即使有联系,联系也很松散。逻辑内聚巧合内聚软件设计的目标:高内聚,低耦合增强模块内的关联性,降低模块间的关联性增强模块的独立性Design

14、 For Reuse软件应作为一种可复用的资产,软件复用可带来较高的投资回报率降低开发和维护成本提高交付效率提高质量可复用的软件资产需求、设计、编码、测试解决方案,设计方案工具过程经验和最佳实践软件复用颗粒度软件复用颗粒度应用系统复用COTS (Commercial-Off-The-Shelf)Family applications构件复用复用部分应用系统,从子系统到单一对象功能复用作为单一的功能复用,如标准图形/数学库Some Reuse FactsHitachi: reduced number of late projects from 72% to 7% in 4 yearsToshib

15、a: improved productivity 3 times in 9 years, 50% code reuse; reduced error rate from 7-20 per 1 KLOC to 2-3Fijitsu: improved productivity by 2/3, reduced error rate by factor of 10NEC: increased productivity by 26% to 91%HP: shortened time-to-market by factor of 4, reduced error rate by factor of 10

16、“CBSE is changing the way large software systems are developed. CBSE embodies the buy, dont build philosophy shifts the emphasis from programming software to composing software systems. Implementation has given way to integration as the focus. As its foundation is the assumption that there is suffic

17、ient commonality in many large software systems to justify developing reusable components to exploit and satisfy that commonality.”“From Subroutine to Subsystems: Component Based Software Development,” P.C. Clements, American Programmer, 1995基于构件的软件工程基于构件的软件工程(Component Based Software Engineering)构件

18、定义构件定义Software componentA nontrivial, nearly independent, and replaceable part of a system that fulfills a clear function in the context of a well-defined architectureComponent provide/require services through its published interfacesRun-time software componentA dynamic bindable package of one or mo

19、re programs managed as a unit and accessed through documented interfaces that can be discovered in run time构件实例构件实例White-box source level componentsData structure: array, structProcedures or functions: sine(x), sort(x)Class, objectGroup of classesIncomplete, generic class: abstract classes, template

20、sBlack-box binary componentsCompiled libraryGUI-generated user interface, DBMSTools: Excel, WordSUN JAVA Beans, MS ActiveX control, OMG CORBA componentsComponent InterfacesProvides interfaceDefines the services that are provided by the component to other componentsRequires interfaceDefines the servi

21、ces that specifies what services must be made available for the component to execute as specifiedProvides interfaceRequires interfacePrintPrintServiceGetQueueRemoveTransferRegisterUnregisterGetPDfilePrinterIntExample: Printing ServicesPotential BenefitsSpeed up system production by reusing component

22、s as both development and validation time should be reduced.Accelerated developmentStandard components such as user interface components like menus and buttons. Standards complianceInstead of application specialists doing the same work on different projects, these specialists can develop reusable co

23、mponents which encapsulates their knowledge.Effective use of specialistsReduce the uncertainty of project cost estimation, particularly true when large components reuse.Reduced process riskReused components that have been exercised in the working system should be more reliable than new components. T

24、hey have been tried and tested, and faults discovered, eliminated and reduced. Increase reliabilityExplanationBenefitsPotential ProblemsSoftware components have to be discovered in a library, understood and adapted to work in a new environment. Finding and adapting reusable componentsCurrent techniq

25、ues for classifying, cataloguing and retrieving software components are immature.Maintaining a component libraryEngineers prefer to rewrite components. Two reasons exist: trust and looking for challenges. Not-invented-here syndromeCASE toolsets may not support development with reuse. It may be diffi

26、cult or impossible to integrate these tools with a component library system.Lack of tool supportIf component source code is not available then maintenance costs may be increased, as the reused elements of the system may become increasingly incompatible with system changes.Increase maintenance costsE

27、xplanationProblem内容概要内容概要软件设计的基本概念面向对象设计软件体系结构设计Usecase设计用户界面设计主要任务主要任务将OOA所创建的分析模型转化为设计模型,可采用相同的建模语言OOA与OOD是反复迭代的过程,OOD是对OOA模型具体实现的补充增/删/改类、属性、操作同样遵循抽象、信息隐蔽、模块化等基本设计原则UML类、对象及包建模类、对象及包建模(Class, Object, and Package Diagram)Package Diagram包 Package“子系统”,一种分组机制,将模型元素组织成语义相关的组模型元素不能被一个以上的包拥有包之间的关系包含(嵌套

28、)依赖泛化(继承)Class Diagram类图类图类 Class类名属性操作约束接口 Interface展示类/构件的外部可见操作特殊的类,不具备属性、状态及内部实现Class NotationDetails SuppressedAnalysis-level DetailImplementation-level DetailInterfaceCharacterComparableStringByteUML中类之间的关系中类之间的关系关联 Association常规关联两个类之间的关联关联两端可以标明重数 multiplicity,关联的数量范围关联两端可以写上角色名递归关联类与自身的关联多重

29、关联两个以上类的关联多重关联多重关联UML中类之间的关系中类之间的关系有序关联ordered受限关联(qualified association)“限制子 qualifier”或关联两个关联之间存在着或的关系关联类 (association class)说明类之间的关联关系的类受限关联受限关联An instance of the source classifier, together with a value of the qualifier, uniquely select a partition in the set of the target classifier instance.或关

30、联或关联递归关联递归关联关联类关联类UML中类之间的关系中类之间的关系聚集共享聚集 (shared aggregation)“部分”可以参加多个“整体”组成聚集 (composition aggregation )“部分”仅存在“整体”之中,随“整体”消亡而消亡泛化 Generalization继承 Inheritance 依赖 Dependency共享聚集共享聚集组成聚集组成聚集对象图对象图类的实例类对象对象内容概要内容概要软件设计的基本概念面向对象设计及UML软件体系结构设计Usecase设计用户界面设计Why Software ArchitectureProgram Software S

31、ystemsIncreases in size and complexityProgramming Language Software ArchitectureMachine languageHigh-level language Abstract Data TypeSoftware ArchitectureData Structure & AlgorithmProgramming in the SmallProgramming in the largeComponents & ConnectorsWhy Software ArchitectureArchitectures as the fr

32、amework for satisfying requirementsArchitectures as the technical basis for design and as the managerial basis for cost estimation and process managementArchitecture as an effective basis for reuseArchitecture as the basis for dependency and consistency analysis“Foundations for the study of software

33、 architecture”D.E. Perry and A.L. Wolf, 1992软件体系结构定义软件体系结构定义 “The fundamental organization of a system, embodied in its components, their relationships to each other and the environment, and the principles governing its design and evolution.”ANSI/IEEE Std 1471-2000, Recommended Practice for Architec

34、tural Description of Software-Intensive SystemsCommon Architecture Styles Indep. components Event-based Data Flow Pipes and Filters Call / Return Layered Data Centered Repositories Virtual MachineInterpreters Distributed Client/ServerLayered: Definition“Layered system is organized hierarchically, ea

35、ch layer providing service to the layer above it and serving as a client to the layer below. Layers may be hidden to all except adjacent layers or layers may be partially hidden.”COREUser InterfaceBusiness LogicBasic UtitilySAPLayer N+1Layer NinterfacePresentationApplicationPresentationApplicationAp

36、plication ProtocolPresentation ProtocolPhysicalData LinkNetworkTransportSessionPresentationApplicationOSI 模型模型Layered: ElementsComponents: LayersGroup of subtasks which implement a “virtual machine” at certain layer in the hierarchyConnectors: Protocol / InterfaceEach layer hides lower layer and pro

37、vides services to higher layerEach layer serves distinct functions Layered: AdvantageProblem decompositionIncreasing levels of abstraction, partition complex problemsSystem maintenanceA layer only interacts with the layer above the one below. Limited change effectSystem reuseEach layer supports a se

38、t of standard interfacesDifferent implementations of the same interfaces can be interchangedLayered: DisadvantageLayered abstraction is difficultOpaque layers prevent user control of deep functionalityCommunication down through layers and back up may cause performance penaltyClient/Server: Definitio

39、n“The client/server software architecture is a versatile, message-based and modular infrastructure that is intended to improve usability, flexibility, interoperability, and scalability as compared to centralized, mainframe, time sharing computing. ”Usability: the ease with which a user can learn to

40、operate, prepare inputs for, and interpret outputs of a system or componentClient/Server: DefinitionFlexibility: the ease with which a system or component can be modified for use in applications or environments other than those for which it was specifically designed Interoperability: the ability of

41、two or more systems or components to exchange information and to use the information that has been exchanged Scalability: the ease with which a system or component can be modified to fit the problem area. Client/Server: ElementsDistributed system model which shows how data and processing is distribu

42、ted across a range of componentsSet of stand-alone servers which provide specific services such as printing, data management, etc.Set of clients which call on these servicesClients know of servers but servers need not know of clientsClients and servers are logical processesNetwork which allows clien

43、ts to access serversExample: Film and picture libraryCatalogueserverCatalogueVideoserverFilm clipfilesPictureserverDigitizedphotographsHypertextserverHypertextwebClient 1Client 2Client 3Client 4Wide-bandwidth networkClient/Server: TypesTwo tier C/S with thin clientsAll of the application processing

44、and data management is carried out on the server. The client is simply responsible for running the presentation software.Two tier C/S with fat clientsthe server is only responsible for data management. The software on the client implements the application logic and the interactions with the system u

45、serThree tier or multi-tier C/Seach of the application architecture layers may execute on a separate processorMiddle tier: queuing, application execution, and database staging Client/Server: TypesClientServerData ManagementApplication ProcessingPresentationClientServerData ManagementPresentationAppl

46、ication ProcessingTwo Tier with Thin ClientTwo Tier with Fat ClientServerApplication ProcessingServerDataManagementClientPresentationThree TierClient/Server: UsageFat Client Two tierCOST (Component-Of-The-Shelf) on the client (e.g. MS Excel)Computationally intensive processing of data is required (e

47、.g. data visualization)Relatively stable end-user functionality used in an environment with well-established system managementClient/Server: UsageThin Client Two TierLegacy application where separating application processing and data management is impracticalComputationally intensive applications wi

48、th little or no data management (e.g. Compiler)Data-intensive applications with little or no application processingClient/Server: UsageThree / multi-tierLarge scale applications with hundreds or thousands of clientsApplications where both data and the application are volatileApplications where data

49、from multiple sources are integratedClient/Server: DiscussionAdvantagesDistribution of data is straightforwardMakes effective use of networked systems. May require cheaper hardwareEasy to add new servers or upgrade existing serversDisadvantagesNo shared data model so sub-systems use different data o

50、rganisation. data interchange may be inefficientRedundant management in each serverNo central register of names and services - it may be hard to find out what servers and services are availableMaintenance of distributed client Client/Server To Browser/Server内容概要内容概要软件设计的基本概念面向对象设计及UML软件体系结构设计Usecase

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 办公、行业 > 各类PPT课件(模板)
版权提示 | 免责声明

1,本文(软件设计课件.ppt)为本站会员(三亚风情)主动上传,163文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。
2,用户下载本文档,所消耗的文币(积分)将全额增加到上传者的账号。
3, 若此文所含内容侵犯了您的版权或隐私,请立即通知163文库(发送邮件至3464097650@qq.com或直接QQ联系客服),我们立即给予删除!


侵权处理QQ:3464097650--上传资料QQ:3464097650

【声明】本站为“文档C2C交易模式”,即用户上传的文档直接卖给(下载)用户,本站只是网络空间服务平台,本站所有原创文档下载所得归上传人所有,如您发现上传作品侵犯了您的版权,请立刻联系我们并提供证据,我们将在3个工作日内予以改正。


163文库-Www.163Wenku.Com |网站地图|