Object-oriented Design.ppt_第1頁
Object-oriented Design.ppt_第2頁
Object-oriented Design.ppt_第3頁
Object-oriented Design.ppt_第4頁
Object-oriented Design.ppt_第5頁
已閱讀5頁,還剩37頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、Object-oriented Design(面向?qū)ο笤O(shè)計(jì)),Designing systems using self-contained objects and object classes(自包含的對(duì)象和類),Three hierarchy of Object-Oriented,Object-Oriented Language(語言) Object-Oriented Software Engineering(方法) Object-Oriented Database(數(shù)據(jù)庫),Objectives,To explain how a software design may be represe

2、nted as a set of interacting objects that manage their own state and operations To describe the activities in the object-oriented design process To introduce various models that describe an object-oriented design To show how the UML may be used to represent these models,Topics covered,Objects and ob

3、ject classes An object-oriented design process Design evolution,Characteristics of OOD(特點(diǎn)),Objects are abstractions of real-world or system entities and manage themselves現(xiàn)實(shí)的抽象 Objects are independent and encapsulate state and representation information. 獨(dú)立封裝 System functionality is expressed in term

4、s of object services系統(tǒng)功能=服務(wù) Shared data areas are eliminated. Objects communicate by message passing 沒有共享數(shù)據(jù),通過消息傳遞 Objects may be distributed and may execute sequentially or in parallel對(duì)象是分布的,串、并運(yùn)行,Interacting objects,Advantages of OOD(優(yōu)點(diǎn)),Easier maintenance. Objects may be understood as stand-alone

5、 entities Objects are appropriate reusable components For some systems, there may be an obvious mapping from real world entities to system objects 易維護(hù)、可重用、與現(xiàn)實(shí)的匹配,Object-oriented development面向?qū)ο蟮拈_發(fā),Object-oriented analysis, design and programming are related but distinct OOA is concerned with develop

6、ing an object model of the application domain OOD is concerned with developing an object-oriented system model to implement requirements OOP is concerned with realising an OOD using an OO programming language such as Java or C+,Objects and object classes(對(duì)象和類),Objects are entities in a software syst

7、em which represent instances of real-world and system entities(對(duì)象是實(shí)體) Object classes are templates for objects. They may be used to create objects(類是模板) Object classes may inherit attributes and services from other object classes (可繼承),Objects(對(duì)象),An object is an entity which has a state and a defin

8、ed set of operations which operate on that state. The state is represented as a set of object attributes. The operations associated with the object provide services to other objects (clients) which request these services when some computation is required. Objects are created according to some object

9、 class definition. An object class definition serves as a template for objects. It includes declarations of all the attributes and services which should be associated with an object of that class.,The Unified Modeling Language,Several different notations for describing object-oriented designs were p

10、roposed in the 1980s and 1990s The Unified Modelling Language is an integration of these notations It describes notations for a number of different models that may be produced during OO analysis and design It is now a de facto standard for OO modelling,Employee object class (UML),Object communicatio

11、n(通訊),Conceptually, objects communicate by message passing. Messages The name of the service requested by the calling object. In practice, messages are often implemented by procedure calls(過程調(diào)用) Name = procedure name. Information = parameter list.,Generalisation and inheritance泛化和繼承,Objects are memb

12、ers of classes which define attribute types and operations Classes may be arranged in a class hierarchy where one class (a super-class) is a generalisation of one or more other classes (sub-classes) A sub-class inherits the attributes and operations from its super class and may add new methods or at

13、tributes of its own Generalisation in the UML is implemented as inheritance in OO programming languages,A generalisation hierarchy(泛化),Advantages of inheritance(繼承優(yōu)點(diǎn)),It is an abstraction mechanism which may be used to classify entities It is a reuse mechanism at both the design and the programming

14、level The inheritance graph is a source of organisational knowledge about domains and systems,Problems with inheritance(問題),Object classes are not self-contained. they cannot be understood without reference to their super-classes難理解 Designers have a tendency to reuse the inheritance graph created du

15、ring analysis. Can lead to significant inefficiency無效 The inheritance graphs of analysis, design and implementation have different functions and should be separately maintained獨(dú)立維護(hù),An object-oriented design process,Define the context and modes of use of the system定義系統(tǒng)范圍 Design the system architectur

16、e定義系統(tǒng)架構(gòu) Identify the principal system objects鑒別類 Develop design models開發(fā)設(shè)計(jì)模型 Specify object interfaces定義對(duì)象界面,Weather system description,A weather data collection system is required to generate weather maps on a regular basis using data collected from remote, unattended weather stations and other dat

17、a sources such as weather observers, balloons and satellites. Weather stations transmit their data to the area computer in response to a request from that machine. The area computer validates the collected data and integrates it with the data from different sources. The integrated data is archived a

18、nd, using data from this archive and a digitised map database a set of local weather maps is created. Maps may be printed for distribution on a special-purpose map printer or may be displayed in a number of different formats.,Weather station description,A weather station is a package of software con

19、trolled instruments which collects data, performs some data processing and transmits this data for further processing. The instruments include air and ground thermometers, an anemometer, a wind vane, a barometer and a rain gauge. Data is collected every five minutes. When a command is issued to tran

20、smit the weather data, the weather station processes and summarises the collected data. The summarised data is transmitted to the mapping computer when a request is received.,Layered architecture,Subsystems in the weather mapping system,Use-cases for the weather station,Use-case description,Architec

21、tural design,Once interactions between the system and its environment have been understood, you use this information for designing the system architecture Layered architecture is appropriate for the weather station Interface layer for handling communications Data collection layer for managing instru

22、ments Instruments layer for collecting data There should be no more than 7 entities in an architectural model,Weather station architecture,Object identification(鑒別對(duì)象),Identifying objects (or object classes) is the most difficult part of object oriented design There is no magic formula for object ide

23、ntification. It relies on the skill, experience and domain knowledge of system designers Object identification is an iterative process. You are unlikely to get it right first time,Approaches to identification,Use a grammatical approach based on a natural language description of the system Base the i

24、dentification on tangible things in the application domain Use a behavioural approach and identify objects based on what participates in what behaviour Use a scenario-based analysis. The objects, attributes and methods in each scenario are identified,Weather station object classes,Ground thermometer

25、, Anemometer, Barometer Application domain objects that are hardware objects related to the instruments in the system Weather station The basic interface of the weather station to its environment. It therefore reflects the interactions identified in the use-case model Weather data Encapsulates the s

26、ummarised data from the instruments,Weather station object classes,Further objects and object refinement類的進(jìn)一步細(xì)化,Use domain knowledge to identify more objects and operations Weather stations should have a unique identifier Weather stations are remotely situated so instrument failures have to be repor

27、ted automatically. Therefore attributes and operations for self-checking are required Active or passive objects In this case, objects are passive and collect data on request rather than autonomously. This introduces flexibility at the expense of controller processing time,Design models,Design models

28、 show the objects and object classes and relationships between these entities Static models describe the static structure of the system in terms of object classes and relationships Dynamic models describe the dynamic interactions between objects.,Examples of design models,Sub-system models that show

29、 logical groupings of objects into coherent subsystems Sequence models that show the sequence of object interactions State machine models that show how individual objects change their state in response to events Other models include use-case models, aggregation models, generalisation models,etc.,Sub

30、system models,Shows how the design is organised into logically related groups of objects In the UML, these are shown using packages - an encapsulation construct. This is a logical model. The actual organisation of objects in the system may be different.,Weather station subsystems,Sequence models,Seq

31、uence models show the sequence of object interactions that take place Objects are arranged horizontally across the top Time is represented vertically so models are read top to bottom Interactions are represented by labelled arrows, Different styles of arrow represent different types of interaction A

32、 thin rectangle in an object lifeline represents the time when the object is the controlling object in the system,Design evolution,Hiding information inside objects means that changes made to an object do not affect other objects in an unpredictable way Assume pollution monitoring facilities are to be added to weather stations. These sample the air and compute the amount of different pollutants in the atmosphere Pollution readings are transmitted with weather data,Changes

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論