软件工程概论:第六章 对象

上传人:大米 文档编号:569142041 上传时间:2024-07-27 格式:PPT 页数:159 大小:2.33MB
返回 下载 相关 举报
软件工程概论:第六章 对象_第1页
第1页 / 共159页
软件工程概论:第六章 对象_第2页
第2页 / 共159页
软件工程概论:第六章 对象_第3页
第3页 / 共159页
软件工程概论:第六章 对象_第4页
第4页 / 共159页
软件工程概论:第六章 对象_第5页
第5页 / 共159页
点击查看更多>>
资源描述

《软件工程概论:第六章 对象》由会员分享,可在线阅读,更多相关《软件工程概论:第六章 对象(159页珍藏版)》请在金锄头文库上搜索。

1、SOFTWARE ENGINEERING 软件工程软件工程Considering Objects 对象6.1 What is OO (Object orientation)什么是面向对象?Object orientation is an approach to software development that organizes both the problem and its solution as a collection of discrete objects; both data structure and behavior are included in the represent

2、ation.面向对象是一种软件开发方法,它由问题和问题的解决方法组成不连续对象的集合;数据结构和行为都包含在表示中。Object 的特点以数据为中心;对象是主动的;属性和操作封装,信息是隐蔽的;对象独立处理自身的数据,并通过消息传递进行通信,具有并行的性质;高模块独立性,对象是OO软件的基本模块,低耦合,高内聚;对象具有唯一识别的功能,行为比较丰富;对象必须参与一个或多个对象类。Class 类定义l具有相同结构、操作,并遵守相同约束规则的对象聚合成一组,这组对象集合称为对象类,简称类。类层次(Hierarchy)l子类、派生类l父类、基类、超类类实例(Instance)l由某个特定类所描述的一

3、个具体对象。l如类抽象“中国人”的一个实例“王志东”消息就是某个操作的规格说明,其组成:l接收消息的对象l消息名(消息选择符)l零个、一个或多个变元例如:对于类Circle的一个实例MyCircle,如果使其以绿色在屏幕上显示,MyCircle . Show ( GREEN );方法(操作、服务)l对象所能执行的操作,即类中所定义的服务。它是对操作算法和响应消息办法的描述。l在类Circle中给出成员函数Show (int color)的定义。属性是类中所定义的数据,是实体性质的抽象l类实例都有其特有的属性值,如类Circle定义的圆心、半径和颜色。消息、方法与属性The History of

4、 OT 对象技术的历史 We can recognize an OO representation by its seven characteristics(我们可以从它的7个特征来认识OO):1、Identity 一致性2、Abstraction 抽 象3、Classification 分 类4、Encapsulation 封 装5、Inheritance 继 承6、Polymorphism 多态性7、Persistence 连续性特征一、Identity(一致性) Identity refers to the fact that the data are organized into di

5、screte, distinguishable entities called objects. A single object has states and behaviors associated with it. Every object has a name (also called a reference or handle). 一致性涉及将数据组成离散的、可辨识的称为对象的实体。单个对象有与之相关的状态和行为。每一个对象都有一个名称(也叫引用或句柄)。特征二、 Abstraction (抽象) Abstraction is essential for building any sy

6、stem, whether OO or not. 构建任何系统时,无论是否使用OO,抽象都是必不可少的。特征三、 Classification(分 类) OO uses classification to group objects that have attributes and behaviors in common. the class definitions and hierarchies are intended to represent a problem or its solution; two different representations may be equally c

7、orrect or useful. We say that each object is an instance of a class. Each instance has own attribute values but shares attribute names and behaviors with the other instances of the class. OO使用分类来给某些有着共同属性和行为的对象分组。类定义和层次是用来表示问题或它的解决方法的,两种不同的表示方法可能同样是正确的或有用的。每个对象都是某个类的实例。每个实例有它自己的属性值,但和该类的其他实例共享属性名称和行

8、为。Examples of objects grouped into classes 对象归类的例子框表示某个对象的名称、属性和行为特征四、Encapsulation(封装) A class encapsulates an objects behaviors and attributes, hiding the implementation details. Encapsulation is then technique for packaging the information in such a way as to hide what should be hidden, and make

9、visible what is intended to be visible. 类封装了某个对象的行为和属性,隐藏了具体的实现。封装是某种将应该隐藏的信息包装起来,并使那些应该可见的信息变得可见的技术。特征五、Inheritance(继承) Some attributes are shared among the members of a given class. We can organize classes hierarchically according to the sameness or difference among each; this hierarchy exhibits t

10、he OO classes inheritance structure. a subclass may inherit the structure as well as the behavior and attributes of its superclass. Sometimes we use an abstract class to simplify the hierarchy. 某些属性在特定类的成员间是共享的。我们可以根据类之间的相同或差异来构造类的层次,这个层次存在于OO类的继承结构中。某个子类可以继承父类的结构、行为和属性。有时我们会用抽象类简化层次。Forming a hiera

11、rchy 组成层次继承性的含义l对象共享所在类的结构、操作和约束等语义特性继承性的作用l继承性使所建立的软件系统具有开放性l继承是信息组织和分类的有效方法l提高代码可重用率和可靠性,降低开发工作量特征六、Polymorphism(多态性) A behavior is an action or transformation that an objectperforms or to which it is subjected. An objects behavior istriggered by receipt of a particular message, or entrance into a

12、 particular state. Sometimes, the same behavior maybe exhibited differently on different classes or subclasses aproperty call polymorphism. A specific implementation of an operation for a certain class is called a method. In a system with polymorphism, an operation may have more than one method impl

13、ementing. 行为是某个对象执行或作用于该对象的动作或变化。接收到特定信息或加入特定状态后触发对象的行为。有时候,同样的行为在不同的类或子类中表现有不同,这种性质称为多态性。某个类的操作的特定实现称为方法。在多态性系统中,某个操作可能有不止一种实现方法。多态性含义l把相同的操作施加于不同类型的对象,获得不同的结果l虚函数(Virtual)l动态联编(Dynamic binding)特征七、Persistence(连续性) The ability of an objects name, state and behaviors to transcend time or space. 某个对象

14、的名称、状态和行为超越时间或空间的能力。6.2 The OO development process OO开发过程 One advantage of OO development is its consistency of language. We can describe both the problem and the solution in the same terms. this across the-process consistency is a key difference between more traditional procedural development and t

15、he OO development process. OO 开发的好处之一在于这种语言的一致性。可以用同样的术语描述问题及其解决的方案。整个过程的一致性是传统程序开发和OO开发过程的主要区别。OO requirements OO 需求分析 OO requirements analysis is usually done in the users language and discusses the concepts and scenarios likely in the application domain. This expression of the requirement is the

16、same, no matter how the developers decide to implement the system. That is , the requirements definition can independent of its representation as objects. OO需求分析通常是用用户语言开发的,而且要讨论在应用领域可能存在的概念和场景。不管开发人员决定怎样实现系统,需求表达方式是一样的。也就是说,需求定义可以独立于对象的描述。 面向对象需求分析过程需求陈述;建立对象模型;建立动态模型;建立功能模型;定义服务。 需求陈述:问题范围、功能需求、性能

17、需求、应用环境及假设条件;建立对象模型: 1、确定类与对象(找出候选的类与对象、筛选出正确的类与对象); 2、确定关联(初步确定关联、筛选、进一步完善) 3、划分主题:把系统包含的内容分解成若干个范畴; 4、确定属性:分析、选择; 5、识别继承关系; 6、反复修改;建立动态模型: 1、编写脚本:描写用户和目标系统之间的一个或多个典型的交互过程; 2、设想用户界面;(交互行为分应用逻辑和用户界面,是行为的内在内容和外在表现); 3、画事件跟踪图:(确定事件、画出事件跟踪图); 4、画状态图; 5、审查动态模型;建立功能模型 1、画出基本系统模型图; 2、画出功能级数据流图; 3、描述处理框功能;

18、定义服务 1、常规行为; 2、从事件导出的操作; 3、与数据流中处理框对应的操作; 4、利用集成减少冗余的操作;OO 设计In many cases, the OO problem description is same as or similar to the first steps of finding an OO solution. so during OO development, the requirements specification steps may actually be the first steps of system. 在很多情况下,OO问题描述与找出OO解决方案的

19、第一步一样或类似。因此在OO开发过程中,需求规格说明这一步可能实际就是系统设计的第一步。从面向对象的分析到面向对象的设计是一个逐渐扩充模型的过程。 面向对象设计的准则模块化抽象信息隐蔽.弱耦合强内聚可重用The system design is considered to be a high-level design.Beginning with the system design, the program designers take several steps to provide the details essential for Implementation 系统设计是对程序设计的一种

20、高层抽象,从系统设计出发,采用几个步骤为实现提供基本细节:1、they insert computational features in models在模型中插入计算特征.2、they insert some class library details, usually using a bottom-up approach通常使用自底向上的方法插入多个类库的细节.3、they consider nonfunctional requirements, such as performance and security, and enhance the design accordingly 考虑非功

21、能性需求,如性能和安全性并由此改进设计. 面向对象设计的启发规则设计结果应该清晰易懂;一般特殊结构的深度应适当;设计简单的类;使用简单的协议;使用简单的服务;把设计变得减至最小。面向对象设计过程系统分解设计问题域子系统设计人机交互子系统设计任务管理子系统设计数据管理子系统设计类中的服务设计关联设计优化系统分解 1、建立系统交互方式(供应、平等) 2、组织层次 3、设计系统的拓扑结构设计问题域子系统 1、调整需求 2、重用已有的类 3、把问题类组合在一起 4、增添一般化类以建立协议 5、调整继承层次设计人机交互子系统 1、分类用户 2、描述用户 3、设计命令层次 4、设计人机交互类设计任务管理子

22、系统 1、分析并发性 2、设计任务管理 确定事件驱动型任务 确定时钟驱动型任务 确定优先任务 确定关键任务 确定协调任务 尽量减少任务数 确定资源需求设计数据管理子系统 1、选择数据存储管理模式 2、设计数据管理 设计数据格式 设计相应服务设计类中的服务 1、确定类中应有的服务 2、设计实现服务的方法 选择数据结构 设计实现服务的方法 定义内部类和内部操作设计关联 1、关联的遍历 2、实现单向关联 3、实现双向关联 4、关联对象的实现设计优化 1、确定优化优先级 2、提高效率的优化 增加冗余关联以提高访问效率 调整查询次序 保留派生属性 3、调整继承关系 抽象与具体 为提高继承程度而修改类定义

23、 利用委托实现行为共享OO coding and TestingOO 编码和测试Same activities as other approaches与其他方法一样测试小组测试编码人员测试6.3 Use cases 用例Use Case图主要用于描述系统和外部图主要用于描述系统和外部环境的关系。环境的关系。Use Case: A use case describes behavior that the system exhibits to benefit one or more actors.用例用例是对系统提供的功能的一种描述。是对系统提供的功能的一种描述。Use case diagrams

24、 have four elements: Actors、 Cases、 Extensions、 Uses.用例图有4种元素:执行者、实例、扩充、使用。An actor is a role that an entity plays with respect to the system.执行者是和系统进行交互的实体。The case is a depiction of some aspect of system functionality that is visible to the actor whose perspective is reflected by the use case.实例是对

25、系统功能某方面的描述,执行者通过这些用例反映自己的观点。An extension extends a use case to illustrate a different or deeper perspective.扩充是对用例的扩展,使之描述不同的或更深的观点。A use is actually a reuse of an already-defined use case.使用就是复用已经定义好的用例。SIDEBAR(附注)6.1ROYAL SERVICE STATION REQUIREMENTS皇家服务站的需求1.The Royal Service Station provides thr

26、ee types of services to its customers: refueling, vehicle maintenance, and parking. A customer has the option to be billed automatically at the time of purchase or to be sent a monthly paper bill. In either case, customers can pay using cash, credit card, or personal check. Royal Service Station fue

27、l is sold according to price per gallon, depending on whether the fuel is diesel, regular, or premium. Service is priced according to the cost of parts and labor. Parking is sold according to daily, weekly, and monthly rates. The prices for fuel, maintenance services, parts and parking may vary; onl

28、y the station manager can enter or change price. At his discretion, the station manager may designate a discount on purchases for a particular customer, this discount may vary from one customer to another. A 5% local sales tax applies to all purchases.皇家服务站向顾客提供3种类型的服务:加油、车辆维护和停车。顾客在购买服务时,可以选择是自动开账单

29、还是每月开账单。每种情况顾客都可以使用现金、信用卡或个人支票进行支付。皇家服务站的燃料是按每加仑的价格出售的,还取决于燃料是柴油、普通燃料还是优质燃料。根据零件及劳动的成本制定服务价格。根据每日、每周和每月的价格出售停车服务。加油、维护服务、零件和停车的价格可能不同;只有该站的经理能输入或改变价格。经理可以随意为特定顾客指定折扣,每个顾客的折扣可能不同。所有服务都要交5%的本地销售税。2.The system must track bills on a month-to-month basis and the products and services provided by the gas

30、station on a day-to-day basis. The results of this tracking can be reported to the station manager upon request.系统必须记录每月账单以及加油站每天提供的产品和服务。当经理要求时,就可以提交记录的结果。3. The station manager uses the system to control inventory. The system will warn of low inventory and automatically order new parts and fuel.经理

31、用系统控制存货。如果存货较少,系统将会发出警告,并能自动订购新的零件和燃料。4.The system will track credit history and send warning letters to customers whose payments are overdue. Bills are sent to customers on the first day of the month after the purchases are made. Payment is due on the first day of the succeeding month. Any bills no

32、t paid within 90 days of the billing date will result in cancellation of the customers credit.系统会记录信用卡历史记录,而且当付款拖延时会给顾客发出警告通知。交易后的下个月的第一天会把账单寄给顾客。付款在下下个月的第一天到期。如果货款在截至日90天内还没有支付,就会删除顾客的信用。5.The system applies only to regular repeat customers. A regular repeat customer means a customer identified by

33、name, address, and birthdate who uses the stations services at least once per month for at least six months.系统只适用于常客。常客是确定了姓名、地址和生日的顾客,而且每月至少使用一次加油站的服务,至少使用6个月。6.the system must handle the data requirements for interfacing with other systems. A credit card system is used to process credit card trans

34、actions for products and services. The credit card system uses the card number, name, expiration date, and amount of purchase. After receiving this information, the credit card system confirms that the transaction is approved or denied. The parts ordering system receives the part code and number of

35、parts needed. It returns the date of parts delivery. The fuel ordering system requires a fuel order description consisting of fuel type, number of gallons, station name, and station identification code. It returns the date when the fuel will be delivered.系统必须处理和其他系统接口的数据需求。信用卡系统用来处理购买产品和服务的信用卡交易。信用卡

36、系统使用卡号、姓名、截至日期和购买金额。接收到这些信息后,信用卡系统就会确认批准还是拒绝交易。零件订购系统接收需要的零件代码和数量。返回交付零件的日期。燃料订购系统要求的燃料订购描述由燃料类型、加仑数、加油站名称和加油站确认代码组成。返回何时交付燃料。7.the system must record tax and related information, including tax paid by each customer, as well as tax per item.系统必须记录税收和相关信息,包括每个顾客支付的税款,以及每笔交易的税款。8.the station manager m

37、ust be able to review tax records upon demand.需要时,经理必须能够检查税收记录。9.the system will send periodic messages to customers, reminding them when their vehicles are due for maintenance. Normally, maintenance is needed every six months.系统会定期给顾客发送通知,提醒他们汽车到维护的时间了。正常情况下,每六个月需要进行一次维护。10.customers can rent parki

38、ng spaces in the station parking lot on a day-to-day basis. Each customer must request from the system an available parking space. The station manager can view a monthly report summarizing how many parking summarizing how many parking spaces were available or occupied.顾客可以按天租借加油站停车场的停车位。顾客必须向系统请求提供可

39、用的停车位置。经理可以查看月报告了解有多少停车位可用或已被占用。11.the system maintains a repository of accounting information, accessible by account numbers and by customer name.系统维护一个账户信息库,根据账户号码和顾客名称进行访问。12. The station manager must be able to review accounting information upon demand.需要时,经理必须能够查看账户信息。 13.the system can report

40、an analysis of prices and discounts to the station manager upon request.根据经理提出的要求,系统能够给出对价格和折扣的分析报告。14.the system will automatically notify the owners of dormant accounts. That is, customers who did not make services station purchases over a two-month period will be contacted.系统能够自动通知停用账户的所有者,即,会联系那

41、些超过两个月没有购买加油站服务的顾客。15. the system cannot be unavailable for more than 24 hours.系统不能连续停用超过24小时。16. the system must protect customer information from unauthorized access.如果没有授权,系统应禁止访问顾客的信息。Example :Overview of royal service station用例描述外部实体如何与系统交互的可能场景。服务站执行3类服务:加油、停车、维护。这个场景中顾客是执行者,每种服务会有账单提供给顾客。Acto

42、r执行者Use case用例Extensions 扩展可以扩展用例图。如增加执行者:经理,新服务:预防性维护功能等。再次扩充等。最后扩充Finally, we extend the system ti include all participants. To do that, we look for all entities in the environment (that is, outside the system to be build) that interact with the system to accomplish a task or provide a service.最后,

43、扩展系统,让它包括所有的参与者。为了做到这点,查找环境(即,在构造的系统之外)中与系统进行交互完成某项任务或提供某项服务的所有实体。 We can use a set of questions to help us identify participants(可以用一组问题来帮助确定参与者): 1、What users or groups use the system to perform a task(哪些用户或小组使用系统完成某项任务)? 2、What users or groups are needed so that the system can perform its functio

44、ns(系统完成功能时需要哪些用户或小组)? 3、What external systems use the system to perform a task(哪些外部系统使用系统完成任务)? 4、What external systems, users or groups send information to the System(哪些外部系统、用户或小组给系统发送信息)? 5、What external systems, users or groups receive information from the system(哪些外部系统、用户或小组接收来自系统的信息)?Once we ha

45、ve use cases, we can examine them further to find existing and potential problems. for example, we can ask the following kinds of questions:一旦有了用例,就可以进一步检查它们,看看是否能找出现有的和潜在的问题。例如,可以提出以下问题:Do the use cases use the right terminology? That is, are there two or more terms to describe the same entity or a

46、ctor in the requirements?用例是否使用了正确的术语?也就是说,需求中是否有两个或更多的术语描述了同一个实体或执行者?Do the activities match the perspectives? That is, does a use case describe system interaction with a participant in a way that is consistent with the description of the participant itself?活动是否和观点匹配?也就是说,用例描述系统和参与者交互的方式是否与参与者自己的描述

47、一致?Are the descriptions of activities and participants clear and complete? Is there more than one way to interpret the description?对活动和执行者的描述是否清楚而完整?是否有不止一种方法解释描述?Is there an interaction described that is missing its complementary participant description?描述某种交互活动时,是否遗漏了对候补参与者的描述?Is it clear when eac

48、h activity start and ends?每个活动的开始和结束是否明确?Is there an external system or set of users described but not actually involve in an activity or interaction with the system?是否描述了某个外部系统或一组用户,但实际上没有参与系统的某个活动或交互?用例图示例用例图示例用例图示例用例图示例Actor与与Use Case间的连线称为通信关联,间的连线称为通信关联,表示表示Actor与相应与相应Use Case的交互。的交互。无论有无箭头,通信关

49、联都表示双向会话,无论有无箭头,通信关联都表示双向会话,箭头表示箭头表示Actor触发触发Use Case。Decide on a standard for use case specification 确定用例确定用例说明的标准说明的标准Write use cases in structured English 用结构化英语书写用结构化英语书写用例用例Primary actors trigger the use case 主动执行者触发用例主动执行者触发用例Second actors do not trigger the use case 被动执行者不被动执行者不触发用例触发用例Precon

50、ditions constrain the state of the system before the use case can start 前置条件是用例开始前的系统状态前置条件是用例开始前的系统状态Postconditions constrain the state of the system after the used case has executed 后置条件是用例执行后的系统状后置条件是用例执行后的系统状态态The main flow describes “perfect world” steps in a use case 主流描述了用例中主流描述了用例中“理想世界理想世界”

51、的活动步骤的活动步骤Use case specificationUse case specificationUse case: PaySalesTaxID: 1Brief description:Pay Sales tax to the Tax Authority at the end of the business quarter.Primary actors:TimeSecond actors:Tax AuthorityPreconditions:1. It is the end of the business quarter.Main flow:1.The use case starts

52、 when it is the end of the business quarter.2.The system determines the amount of Sales Tax owed to the Tax Authority.3.The system sends an electronic payment to the Tax Autority.Postconditions:1. The Tax Authority receives the correct amunt of Sales Tax.Alternative flows:None.use case 名use case 标识概

53、要描述关联的执行者用例可执行前的系统状态执行步骤可选流用例执行后的系统状态Use case: ManageBasketID: 2Brief description:The customer changes the quantity of an item in the basket.Primary actors:CustomerSecond actors:nonePreconditions:1: The shopping basket contents are visibleMain flow:1. The use case starts when the Customer selects an

54、 item in the basket2. If the Customer selects “delete item” 2.1 The system removes the item from the basket3. If the Customer types in a new quantity 3.1 The system updates the quantity of the item in the basket.Postconditions:NoneAlternative flows:None.事事件件流流中中的的分分支支: Keyword IfUse case: FindProduc

55、tID: 3Brief description:The system finds some products based on Customer search criteria and displays them to the Customer.Primary actors: CustomerSecond actors: nonePreconditions: NoneMain flow:1. The use case starts when the Customer selects “find product”2. The system asks the Customer for search

56、 criteria.(条件)(条件)3. The Customer enters the requested criteria.4. The system searches for products that match the Customers criteria.5. If the system finds some matching products then 5.1 For each product found 5.1.1 The system displays a thumbnail sketch of the product.(缩略图)(缩略图) 5.1.2 The system

57、displays a summary of the product details.(资料)(资料) 5.1.3 The system displays the product price.(价格)(价格)6. Else 6.1 The system tells the Customer that no matching products could be found.Postconditions: NoneAlternative flows: None事件流中的循环:事件流中的循环:Keyword ForUse case: ShowCompanyDetailsID: 4Brief descr

58、iption:The system displays the company details to the CustomerPrimary actors: CustomerSecond actors: nonePreconditions: NoneMain flow:1. The use case starts when the Customer selects “show company details”.(公司资料)(公司资料)2. The system displays a web page showing the company details.3. While the Custome

59、r is browsing the company details 3.1 The system plays some background music. 3.2 The system displays special offers in a banner ad.(广告(广告特殊优惠)特殊优惠)Postconditions: 1. The system has displayed the company details.2. The system has played background music.3. The system has displayed special offers.Alt

60、ernative flows: None事件流中的循环:事件流中的循环:Keyword While可选流Each use case has one main flow and may have many alternative flows. Alternative flows often do not return to the use case main flow.use casemain flowalternative flowAlternative flows may be triggered in three different ways:可选流可以被可选流可以被3种不同的方式触发种不

61、同的方式触发l1. The alternative flow may be triggered instead of the main flow.(替代主流)(替代主流)l2. The alternative flow may be triggered after a particular step in the main flow. (1. The alternative flow begins after step X of the main flow.)l3. The alternative flow may be triggered at any time during the mai

62、n flow. (1.The alternative flow begins at any time.)Should you wish the alternative flow to return to the main flow, you can express this as follows:lN. The alternative flow returns to step M of the main flow.Use case: CreateNewCustomerAccountID: 5Brief description: The system create a new account f

63、or the Customer.Primary actors: CustomerSecond actors: nonePreconditions: NoneMain flow:1. The use case begins when the Customer selects “create new customer account”2. While the customer details are invalid(资料无效)(资料无效) 2.1 The system asks the Customer to enter his or her details comprising e-mail a

64、ddress, password, and password again for confirmation 2.2 The system validates the Customer details.(验证)(验证)3. The system creates a new account for the CustomerPostconditions:1. A new account has been created for the customerAlternative flows:InvalidEmailAddressInvalidPasswordCancelAlternative flow:

65、 CreateNewCustomerAccount: InvalidEmailAddressID: 5.1Brief description: The system informs the Customer that he or she has entered an invalid e-mail address.Primary actors: CustomerSecond actors: nonePreconditions: 1. The Customer has entered an invalid e-mail addressAlternative flow:1. The alternat

66、ive flow begins after step 2.2 of the main flow2. The system informs the Customer that he or she entered an invalid e-mail addressPostconditions:noneAlternative flow: CreateNewCustomerAccount: CancelID: 5.2Brief description: The Customer cancels the account creation processPrimary actors: CustomerSe

67、cond actors: nonePreconditions: Alternative flow:1. The alternative flow begins at any time2. The customer cancels account creationPostconditions:1. A new account has not been created for the Customer6.4 representing OO: an example using UMLOO的表示:一个UML示例UML Unified Modeling Language 统一建模语言Directly u

68、nifies the methods of Booch, Rumbaugh ,Jacobson and standardization process with OMG(Object Management Group)UML融合了Booch等方法中的基本概念,而且这些基本概念与其他面向对象技术中的基本概念大多相同;UML不仅仅是上述方法的简单汇合,而是扩展了现有方法的应用范围;UML是标准的建模语言,而不是标准的开发过程。尽管UML的应用必然以系统的开发过程为背景,但由于不同的组织和不同的应用领域,需要采取不同的开发过程。 UML的定义UML的语义l描述基于UML的精确元模型定义。l元模型为U

69、ML的所有元素在语法和语义上提供了简单、一致、通用的定义性说明,使开发者能在语义上取得一致,消除了因人而异的最佳表达方法所造成的影响。此外UML还支持对元模型的扩展定义。UML表示法l定义UML符号的表示法,为开发者或开发工具使用这些图形符号和文本语法为系统建模提供了标准。这些图形符号和文字所表达的是应用级的模型,在语义上它是UML元模型的实例。 UML的用于描述模型的基本词汇(“构造块”):l事物(Things)(要素)l 关系(Relationships)l 图 (Diagrames)事物(Things)l结构事物(Structure Thing)UML中的静态元素:类、接口、协作等l行为

70、事物(Behavioral Thing)UML中的静态元素:交互(Interaction)、状态机(State Machine)l组织事物(Grouping Thing)UML的分组元素:包(Package) l注释事物(Annotation Thing)注释(Note)关系(Relationships)l关联关系(Association)l依赖关系(Dependency)l泛化关系(Generalization)l实现关系(Realization)图(Diagrames)l 9种图UML的9种图图名称图名称图定义图定义图图性质性质1类图类图一组类、接口、协作及它们的关系一组类、接口、协作及它

71、们的关系静态图静态图2对象图对象图一组对象及它们的关系一组对象及它们的关系静态图静态图3用例图用例图一组用例、参与者及它们的关系一组用例、参与者及它们的关系静态图静态图4顺序图顺序图一个交互,强调消息的时间顺序一个交互,强调消息的时间顺序动态图动态图5协作图协作图一个交互,强调消息发送和接受的对象的一个交互,强调消息发送和接受的对象的结构组织结构组织动态图动态图6状态图状态图一个状态机,强调对象按事件排序的行为一个状态机,强调对象按事件排序的行为动态图动态图7活动图活动图一个状态机,强调从活动到活动的流动一个状态机,强调从活动到活动的流动动态图动态图8构件图构件图一组构件及关系一组构件及关系静

72、态图静态图9配置图配置图(实施图实施图)一组结点及它们的关系一组结点及它们的关系静态图静态图包图包图: 包中的类以及包与包之间的关系包中的类以及包与包之间的关系(静态图静态图)UML的9个模型序号序号模型名称模型名称模型定义和解释模型定义和解释1业务模型业务模型建立业务流程的抽象建立业务流程的抽象2领域模型领域模型建立系统的语境建立系统的语境(业务操作规则业务操作规则)3用例模型用例模型建立系统的功能需求建立系统的功能需求4分析模型分析模型建立概念设计(逻辑设计)建立概念设计(逻辑设计)5设计模型设计模型建立问题的解决方案建立问题的解决方案6过程模型过程模型建立系统的并发和同步机制建立系统的并

73、发和同步机制7部署模型部署模型建立系统的硬件拓扑网络结构建立系统的硬件拓扑网络结构8实现模型实现模型建立的软硬件配置设计建立的软硬件配置设计9测试模型测试模型建立系统的测试计划设计建立系统的测试计划设计UML的5种视图在UML 中,系统的表示使用5种不同的“视图” ( UML定义的五类图,共 9 种图形),它们可以从软件开发的不同阶段、不同视角 和不同层次对所开发的系统进行描述。每个视图由一组图定义。l用户模型视图:使用use-case建模l结构模型视图:对静态结构(类、对象和关系)建模l行为模型视图:使用表示系统的动态或行为l实现模型视图:表示系统的结构和行为l环境模型视图:表示系统将实现的

74、环境的结构和行为UML的的5种视图种视图视图名称视图名称视图内容视图内容静态表现静态表现动态表现动态表现观察角度观察角度1用户模型视图用户模型视图(用例视图)(用例视图)系统行为,动系统行为,动力力用例图用例图交互图、状交互图、状态图、活动态图、活动图图用户、用户、分析员、分析员、测试员测试员2结构模型视图结构模型视图(设计视图)(设计视图)问题及解决方问题及解决方案案类图、对象类图、对象图图交互图、状交互图、状态图、活动态图、活动图图类、类、接口、接口、协作协作3行为模型视图行为模型视图(进程视图)(进程视图)性能、可伸缩性能、可伸缩性,吞吐量性,吞吐量类图、对象类图、对象图图交互图、状交互

75、图、状态图、活动态图、活动图图线程、线程、进程进程4实现模型视图实现模型视图(实现视图)(实现视图)构件、文件构件、文件构件图构件图交互图、状交互图、状态图、活动态图、活动图图配置、配置、发布发布5环境模型视图环境模型视图(实施视图)(实施视图)部件的发布、部件的发布、交付、安装交付、安装配置图配置图(实施图实施图)交互图、状交互图、状态图、活动态图、活动图图拓扑结构拓扑结构 的节点的节点UML can be used to visualize, specify, or document a problem. UML diagrams include the dynamic view of t

76、he system, the static view, restrictions, and formalization. The dynamic view is depicted with use cases, lists of activities, interaction diagrams showing sequences and collaboration, and state machines to illustrate state and their changes. 可以使用UML可视化、定义或记录一个问题。UML图包括系统的动态视图、静态视图、约束和形式化。动态视图描述了用例、

77、活动列表、显示顺序和协作的交互图以及描述状态和变化的状态图。The static view is depicted with class diagrams, showing relationships (association, generalization, dependency, and realization) and extensibility (constraints, tagged values, and stereotypes). In addition, the static view shows packages and deployment. Restrictions an

78、d formalization are expressed with OCL, an Object Constraint Language.静态视图描述了类图,给出了关系(关联、泛化、依赖和实现)以及扩展(约束、标记值和模板)。另外静态视图还包括包和配置。约束和形式化用某种对象约束语言OCL表示。Because OO concepts apply to all parts of development, UML can used throughout the software development process.由于开发的所有部分都使用了OO概念, 所以可以将UML应用在软件开发过程的整个

79、阶段。UML用于软件系统开发的不同阶段 用户需求:l可使用用例图用例图来捕获用户的需求,用例图从用户的角度来描述系统的功能,表示了操作者于系统的一个交互过程。系统分析:l可使用类图类图来描述系统的 静态模型,为了实现用例、类之间需要协作,可用动态模型的状态图状态图、顺序图顺序图、协作图协作图来描述。 分析阶段只考虑问题域的对象建模。需要通过静态模型和动态模型来描述系统结构和系统行为。系统设计:l对类进行细化,如引入人机交互的接口类、处理数据类、处理通信类。系统实现:l用构件图构件图描述代码构件的物理结构以及构件之间的关系。用配配置图置图来描述和定义系统中软硬件的物理通信结构。测试:l可使用类图

80、类图进行单元测试;可使用构件图构件图、协作图协作图进行集成测试;可使用用例图用例图进行确认测试。UML in the process 过程中的UML1、use case diagrams can describe the system to be built by describing the general process that the system must perform. In addition, the use cases can embody the different scenarios that describe how the system will work and h

81、ow the users will interact with the system. These diagrams can be supplemented with an object model that defines classes of objects in terms of their functions. 用例图可以通过描述系统必须执行的大致过程来描述要构造的系统。用例还包括系统如何工作及用户如何和系统交互的不同场景。这些图可以作为根据对象功能定义类的对象模型的补充。UML in the process 过程中的UML2、once the requirement are in g

82、ood shape, design begins with UML state and activity diagrams. The activity diagrams display all the activities that can occur in the system as the values of an object change. In concert with the activity diagrams, we develop state diagrams to show all possible states that an object can take. 一旦需求用较

83、好的形式给出,就可以从UML状态图和活动图开始进行设计。活动图列出了当对象发生变化时,所有可能在系统中出现的活动。状态图和活动图对应,给出了某个对象所有可能的状态。UML in the process 过程中的UML3、design continues by addressing the static structure and object diagrams describes how each class is associated with others, including inheritance relationships. The interactions among classe

84、s are illustrated using sequence diagrams and collaboration diagrams. sequence diagrams show how messages flow from one object to another, formalizing the informal descriptions of events in the requirements. collaboration diagrams use object and sequence information to show the flow of events betwee

85、n objects.考虑设计对象的静态结构。结构和对象图描述了每个类是如何与其他类相关联的,包括继承关系。类之间的交互关系用顺序图和协作图表示。顺序图给出了消息是怎样从一个对象到另一个对象的,使得需求中对事件的非形式描述形式化。协作图使用对象和顺序信息给出对象间的事件流。UML in the process 过程中的UML4、the design can be implemented using package, component, and deployment diagrams. Package diagrams show how the classes are logical divid

86、ed into modules. Component diagrams are often the same as package, but they reflect the actual, final system modules. The deployment diagrams show the network links involved with the application being built. 可以用包图、组件图和配置图实现设计。包图说明了如何按照逻辑把类划分成模块。组件图通常和包图一样,但它们反映了实际系统最后的模块。配置图给出了与网络链接的有关的应用程序。6.5 OO s

87、ystem designOO 系统设计使用书中附注6.1的“royal service station requirements”为例说明设计过程。通过问题的描述,希望得到解决方法。首先从使用UML类图开始。First cut at object classes 初次划分对象类The design process starts with a statement of the requirements. We try to extract nouns, looking for particular items that can suggest our first cut at object cl

88、asses. We seek: Structures, External systems,Devices,Roles,Operating procedures,Places,Organizations, Things that are manipulated by the system to be built。设计过程从需求开始。我们试图提取出名词,寻找对象类的第一次划分的某种选项。我们寻找:结构、外部系统、设备、角色、运行的程序、位置、组织、将要构造的系统要处理的事情。例如从附注6.1的第一条可以尝试提取出:个人支票、账单、信用卡、顾客、加油站经理、购买、加油、服务、折扣、税收、停车、维护、

89、现金、价格等。1.The Royal Service Station provides three types of services to its customers: refueling, vehicle maintenance, and parking. A customer has the option to be billed automatically at the time of purchase or to be sent a monthly paper bill. In either case, customers can pay using cash, credit car

90、d, or personal check. Royal Service Station fuel is sold according to price per gallon, depending on whether the fuel is diesel, regular, or premium. Service is priced according to the cost of parts and labor. Parking is sold according to daily, weekly, and monthly rates. The prices for fuel, mainte

91、nance services, parts and parking may vary; only the station manager can enter or change price. At his discretion, the station manager may designate a discount on purchases for a particular customer, this discount may vary from one customer to another. A 5% local sales tax applies to all purchases.皇

92、家服务站向顾客提供3种类型的服务:加油、车辆维护和停车。顾客在购买服务时,可以选择是自动开账单还是每月开账单。每种情况顾客都可以使用现金、信用卡或个人支票进行支付。皇家服务站的燃料是按每加仑的价格出售的,还取决于燃料是柴油、普通燃料还是优质燃料。根据零件及劳动的成本制定服务价格。根据每日、每周和每月的价格出售停车服务。加油、维护服务、零件和停车的价格可能不同;只有该站的经理能输入或改变价格。经理可以随意为特定顾客指定折扣,每个顾客的折扣可能不同。所有服务都要交5%的本地销售税。Guidelines for building classes 建类的指导方针Extract nouns from s

93、pecification to get candidate classes. We can use these questions as guidelines about what to include in your list of candidate classes (从规格说明的名词中确定候选类。可以用下列问题列表作为指导来确定候选类):What needs to be “processed” in some way? 要用某种方式“处理”什么?What items have multiple attributes? 哪些选项有多个属性?When do you have more tha

94、n one object in a class?何时某个类有不止一个对象?What is based on the requirements themselves, not derived from your understanding of the requirements?什么是基于需求本身的,而不是从需求的理解中得到的?What attributes and operations are always applicable to a class or object?什么属性和操作总是适用于某个类或对象?Guidelines for identifying behaviors 确定行为的指

95、导方针From the requirements statements, we extract verbs, the behaviors will become actions or responsibilities taken by a class or object, or actions done a class or object.可以从需求说明中提取动词,这些行为会变成某个类或对象的动作和责任,或者是作用于某个类或对象的动作。We can look for particular items that suggest behaviors(寻找表示行为的特定项):Imperative v

96、erbs(祈使动词)、Passive verbs(被动词)、Actions(动作)、Things or reminded events(事情或想起来的事件)、Roles(任务)、Operating procedures(运行程序)、Services provided by an organization(某个组织提供的服务)。一种非正式的分析方法把陈述中的名词作为类与对象的候选者形容词作为确定属性的线索动词作为服务的候选者注意需求陈述中隐含的类与对象剔除原则l冗余的l无关的l笼统的l有些名词实际上描述的是其它对象的属性l区分操作、公共服务与类定义的名词和动词l暂缓考虑设计阶段的内容类和对象的进

97、一步调整l属性不适合于该类l属性和服务相同的类l属性和服务相似的类l对同一事物的重复描述UML class diagrams类图ClassAttributeoperation()The UML boxes are placed on the page to represent the relationships of the classes they represent.画出UML框图可以表示类之间的关系。如右图若某个框在另一个框的上面,且用箭头相连,则下面的就是上面的子类,表示继承关系。 Association of classes 类关联关联(associated)和聚集(aggregat

98、ion)关系。Class Diagrams关系通常有四类: 归纳(generalization)、关联(associated)、 聚集(aggregation)和组合(composition)。 UML还有其他的表示关系方法。如依赖(dependency)、浏览(navigation)等。Enhanced Class DiagramsIn connection with an Order, there may be one Order Line for each instance of Product.First Cut at Royal Service Station Design 第一步设

99、计类框图Improve 改进Add a Message Class .warning letter and periodic message are different types of Message.增加信息类使报警信和定期通知是不同类型消息。The fuel class should be connected to inventory class。将燃料类和存货类连接起来。Delete the account class(has only one attribute) and add the account number to the customer class.删除账户类(因为他只有

100、一个属性)并在顾客类中增加帐户号属性。Add three new class, refuel, parking space, service.增加3个新类,加油、停车位和服务。For taking advantage of the polymorphism利用多态性(服务类)The price and discount can be different depending on what service is required. 价格和折扣可能会不同,取决于服务。Remove the discount rate from the fuel class .删除燃料类中的折扣率。Remove th

101、e price from the fuel class and add it to the refuel class删除燃料类中的价格把它加到加油类中。Put the price of a parking space in the parking class, location in the parking space class.停车位价格放入停车类,位置放到停车位类中。Second Cut at Royal Service Station design第二步设计类框图FFDelete Station Manager class 删除加油站经理类。Add service station to

102、 handle the tracking of dormant accounts 增加服务站类跟踪待用账户。Add operations to each class to reflected the functionality required.为每个类加上操作以反映功能需求。Final cut at Royal Service Station design 最终设计类框图Other UML Diagrams 其他UML图Class description template类描述模板Package diagrams 包图Sequence diagrams 顺序图Collaboration di

103、agrams 协作图State diagrams 状态图Activity diagrams 活动图Class name: refuelCategory: serviceExternal documents:Export control: PublicCardinality: nHierarchy:Superclasses: servicesAssociations:fuel in association Operation name: pricePublic member of: refuelDocumentation:/ Calculates fuel final pricePrecondi

104、tions:gallons 0Object diagram: (unspecified)Semantics:final_price = gallons * priceObject diagram: (unspecified)Concurrency: sequentialPublic interface:Operations:pricePrivate interface:Attributes:gallonspriceImplementation:Attributes:gallonspriceState machine: noConcurrency: sequentialPersistence:

105、transientClass description template 类描述模板Package diagrams 包图View the system as a small collection of the packages. The packages diagrams show the dependencies among classes as they belong to different packages.将系统看作是包的集合。当各个类属于不同的包时,包图给出了类之间的依赖关系。Interaction Diagrams 交互图 UML also includes interactio

106、n diagrams, used to describe how operations and behaviors are handled by the objects in the design. We usually generate one interaction diagram from each use case to identify the messages and operations that represent the systems overall functionality. UML还包括交互图,用来描述设计中的对象如何处理操作和行为。通常每个用例生成一张交互图,以确定

107、表示系统全局功能的消息和操作。 There are two kinds of interaction diagrams: sequence and collaboration.有两种类型的交互图:顺序图和协作图。Sequence diagram for the refuel use caseCustomerService StationCredit CardSystemPurchaseRefuelrefuel( )Verify customer(credit_card_sum, amount )new_purchase (customer, refuel, date, gallons)new_

108、refuel (customer, date, gallons)cancelcredit cardtransactiontransactionokaypay_by_cash( )objects lifelinestart or end of a message message message name condition object 协作图也基于用例,它说明如何静态连接各个对象。协作图中使用的消息层次编号能反映协作图中使用的消息层次编号能反映协作图中使用的消息层次编号能反映协作图中使用的消息层次编号能反映激活激活激活激活的嵌套性质,这在顺序图的嵌套性质,这在顺序图的嵌套性质,这在顺序图的嵌套

109、性质,这在顺序图中能显式地表示出来。中能显式地表示出来。中能显式地表示出来。中能显式地表示出来。Collaboration diagram for the parking use case 停车用例的协作图CustomerParking SpacePurchaseParkingService Station1: parking( )2: next_available( )3: parking_at(location)4: new_purchase(customer, parking, date, location)5: new_parking(customer, location) UML s

110、upports two more kinds of diagrams, state and activity, to document a dynamic model of the system.UML 还支持另外两种图,状态图和活动图,记录系统的动态模型。State diagram shows the possible states an object can take,the events that trigger the transition from one state to the next,and the actions that result from each state ch

111、ange.状态图列出了某个对象存在的所有可能的状态、从一个状态到下个状态所需触发的事件、以及每一个状态变化得到的活动。State Diagrams Examples 状态图例状态图的概念与状态变迁图类似。如图,用黑圆圈点表示起始节点,白圆圈中放小黑点表示结束。长方型表示状态,箭头表示状态的变迁,箭头边带括号的表达式表示条件。左图是皇家服务站的燃料和零件状态图。State diagrams for inventory class 存货类状态图Activity Diagram 活动图UML uses an activity diagram to model the flow of procedur

112、es or activities in a class. when conditions are used to decide which activity to invoke, the activity diagram use a decision node to represent the choises. 活动图为在某个类中的过程或活动流进行建模。当用条件来判断调用那个活动时,活动图就用决策节点来表示备选项。符号与状态图类似。Activity diagrams for inventory class 存货类活动图OO Program designOO 程序设计程序设计要考虑的事项是,首先

113、从系统设计中得到对象和类,然后对它们加以细化和修改使之包含下列内容:Nonfunctional requirements,such as performance and input/output constraints 非功能性需求,如性能和输入/输出约束。Reused components from previously 复用以前构造的系统中的组件。Reusable components intended for use in more systems than just the one at hand 不仅用在现在的系统中,而且可用于更多系统中的可复用的组件。User interface

114、requirements 用户界面需求。Data structure and management details 数据结构和管理细节。OO 程序设计要注意的问题比照系统设计必须对数据作出更多的细节判断。必须确定每个对象与环境接口的特性,需要知道每个操作签名,也就是给每个操作命名。利用OO的多态性。恰当使用继承及组合(封装)。Design Aids 设计辅助常用的设计辅助有工具包、框架及模式.Toolkit(工具包): a set of related, reusable classes that provide a well-defined set of functionality. Too

115、lkit are much like the subroutine libraries of procedural languages. 工具包是一组相关的、具有明确定义功能的类的集合。它更像过程语言的子程序库。Pattern: a template of abstract architectural elements that can be used to guide you in generating your design. 模式是可用来指导生成设计的抽象结构元素的模板。Framework: a reuse of part of a domain-specific design. 框架是

116、一个特殊领域设计部分的复用。User Interface Design用户界面设计OO程序设计的用户界面部分必须考虑一下问题:Defining the humans who will interact with the system 定义谁与系统进行交互。Developing scenarios for each way that the system can perform a task 开发系统执行任务的每种方法的场景。Designing a hierarchy of user commands 设计用户的命令层次。Refining the sequence of user interac

117、tions with the system改进用户与系统交互的顺序。Designing relevant classes in the hierarchy to implement the user interface design decisions 设计层次中相关的类,实现用户界面设计的决定。Integrating the user classes in the overall system class hierarchy 用户界面类集成到全部的系统类层次中。Data Management Design 数据管理设计程序设计必须提供存储和恢复连续数据的方法,数据管理考虑性能和空间方面的系统

118、要求,必须为对象和它的操作安排一个设计,可以用4步完成这个任务:Identify the data, data structures, and relationships among them 确定数据、数据结构以及它们之间的关系。Design services to manage the data structures and relationships 设计服务去管理数据结构和关系。Find tools, such as database management systems, to implement some of the data management tasks 找出类似于数据库管

119、理系统之类的工具来实现某些数据管理任务。Design classes and class hierarchies to oversee the data management functions 设计类和类的层次结构来检查数据管理功能。Task Management Design 任务管理设计任务管理是程序设计中的关键部分。必须仔细审查需求,并确定如何调整系统要执行的活动。一个任务指系统中的一个过程,它可能是事件驱动的或时间驱动的。可以用4步完成任务管理的设计:Identify the tasks to be performed, and classify them as event- or

120、time- driven 确定要执行的任务,并按照是事件驱动还是时间驱动进行分类。Determine priorities for the tasks. That is, for each pair of tasks, decide which one has priority if two are to be invoked simultaneously 确定任务的优先级。即当同时调用两个任务时,确定哪个有优先权。Create a task to coordinate all other tasks 创建任务来协调所有的任务。Design objects for each task, and

121、 define the relationships among them 为每个任务设计对象,并定义它们之间的关系。OO Measurement OO度量Once we have an OO implementation of a system, how can we measure its properties? Such as low coupling and high cohesion, and that we can measure properties such as design complexity. How do we measure such characteristics

122、in OO system?有了系统的OO实现,怎么度量它的特性?如低耦合和高内聚,以及可以度量设计复杂度之类的好的设计特征。在OO系统中怎样衡量这些特征?OO Size Measures OO规模度量lPfleeger(1991) used objects and methods as basic size measure. Pfleeger(1991)使用了对象和方法作为基本的规模度量标准。 lOlsen(1993) applied this technique to a commercial project and the estimates were extraordinarily ac

123、curate. Olsen(1993) 将这种方法应用到商业项目中,所得的估计格外准确。lLorenz and Kidd(1994) yielded a finer level of detail. Lorenz and Kidd(1994) 扩展到更细的层次。Lorenz and Kidd method规模的9个方面:NSS-number of scenario scripts 场景脚本的数量Number of key classes (domain classes) 关键类的数量Number of support classes 支持类的数量Average number of suppor

124、t classes per key classes 每个关键类的支持类的平均数量Number of subsystems 子系统的数量Class size: sum (NoO, NoA) 类的大小Number of operations overridden by a subclass 子类重载的操作数Number of operations added by a subclass子类增加的操作数SI: specialization index 特殊索引lSI=(NOOlevel)/(total class methods)Lorenz and KiddTable 6.5: Lorenz an

125、d Kidd metrics collection in different phases of development.不同的开发阶段不同的开发阶段Lorenz and Kidd 度量的集合 PhaseMetricRequirementsDescriptionSystem DesignProgram DesignCodingTesting场景脚本的数量X关键类的数量XX支持类的数量X每个关键类的支持类的 平均数量X子系统的数量XX类的大小XXX子类重载的操作数XXXX子类增加的操作数XXX特殊索引XXXXRoyal Service System example P296度量最小值最大值关键类

126、的个数1717类大小17重载的操作个数01增加的操作个数00特殊索引01OO Design MeasureOO设计度量Chidamber and Kemerer (1994)的标准,侧重于设计而不是规模,对是Lorenz and Kidd工作的补充,加上了以下的评测:度量/阶段系统设计程序设计编码测试每个类的加权方法继承的深度子类的个数对象间的耦合度类的响应方法缺少内聚度Other OO Design MeasurementLi and Henry(1993)在Chidamber and Kemerer 定义上增加了两个度量:lMessage-passing coupling消息传送耦合: t

127、he number of method invocations defined in a class类中定义的方法调用数。lData abstraction coupling数据抽象耦合 : the number of abstract data types used in the measured class and defined in another class of the system度量类的使用、系统其他类中定义的抽象数据类型的个数。Other OO Design MeasurementTravassos(1999)lAverage operation size平均操作规模: th

128、e number of messages sent by an operation 操作发送的消息数。lAverage number of parameters per operation. 每个操作的平均参数个数。结构化设计方法与面向对象设计特点比较从概念方面看l结构化软件是功能功能的集合,通过模块以及模块和模块之间的分层调用关系实现;l面向对象软件是事物事物的集合,通过对象以及对象和对象之间的通讯联系实现;从构成方面看l结构化软件过程数据,以过程为中心;l面向对象软件(数据相应操作)的封装,以数据为中心;从运行控制方面看l结构化软件采用顺序处理方式,由过程驱动控制;l面向对象软件采用交互式、并行处理方式,由消息驱动控制;从开发方面看从开发方面看l结构化方法的工作重点是设计;l面向对象方法的工作重点是分析;在结构化方法中,分析阶段和设计阶段采用了不相吻合的表达方式,需要把在分析阶段采用的具有网络特征的数据流图转换为设计阶段采用的具有分层特征的结构图,在面向对象方法中则不存在这一问题。从应用方面看l结构化方法更加适合数据类型比较简单的数值计算和数据统计管理软件的开发;l面向对象方法更加适合大型复杂的人机交互式软件和数据统计管理软件的开发;

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 高等教育 > 研究生课件

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号