当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

《面向对象软件工程》课程PPT教学课件(英文版)Chapter 2:Review of Object Orientation

资源类别:文库,文档格式:PPT,文档页数:45,文件大小:194.5KB,团购合买
Procedural paradigm: Software is organized around the notion of procedures Procedural abstraction —Works as long as the data is simple Adding data abstractions —Groups together the pieces of data that describe some entity
点击下载完整版文档(PPT)

object-Oriented Software Engineering Practical Software development using uml and Java Chapter 2: Review of object Orientation www.lloseng.com

Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 2: Review of Object Orientation

2. 1 What is object Orientation? Procedural paradigm Software is organized around the notion of procedures Procedural abstraction -Works as long as the data is simple Adding data abstractions -Groups together the pieces of data that describe some entit -Helps reduce the system's complexity Such as records and struc Object oriented paradigm: Organizing procedural abstractions in the context of data abstractions www.lloseng.com O Lethbridge/Laganiere 2001 Chapter 2: Review of object Orientation

© Lethbridge/Laganière 2001 Chapter 2: Review of Object Orientation 2 2.1 What is Object Orientation? Procedural paradigm: • Software is organized around the notion of procedures • Procedural abstraction —Works as long as the data is simple • Adding data abstractions —Groups together the pieces of data that describe some entity —Helps reduce the system’s complexity. - Such as Records and structures Object oriented paradigm: • Organizing procedural abstractions in the context of data abstractions

object Oriented paradigm An approach to the solution of problems in which all computations are performed in the context of objects. The objects are instances of classes, which are data abstractions -contain procedural abstractions that operation on the objects A running program can be seen as a collection of objects collaborating to perform a given task www.lloseng.com O Lethbridge/Laganiere 2001 Chapter 2: Review of object Orientation

© Lethbridge/Laganière 2001 Chapter 2: Review of Object Orientation 3 Object Oriented paradigm An approach to the solution of problems in which all computations are performed in the context of objects. • The objects are instances of classes, which: —are data abstractions —contain procedural abstractions that operation on the objects • A running program can be seen as a collection of objects collaborating to perform a given task

A View of the Two paradigms main Account credit perform transactio debit credit(debit(compute interes compute fees if checking if checking CheckingAccount Sav ings Accour then xxx then xxx if sav ings if savin compute interest compute interest then xxx then xxx compute fees etc etc www.lloseng.com O Lethbridge/Laganiere 2001 Chapter 2: Review of object Orientation 4

© Lethbridge/Laganière 2001 Chapter 2: Review of Object Orientation 4 A View of the Two paradigms main perform transaction compute fees if checking then xxx if sav ings then xxx etc. compute interest if checking then xxx if sav ings then xxx etc. credit debit Account credit debit Sav ingsAccount compute interest compute f ees CheckingAccount compute interest compute f ees

2.2 Classes and objects Obiect a chunk of structured data in a running software system ° Has properties -Represent its state as behaviou How it acts and reacts -May simulate the behaviour of an object in the real world www.lloseng.com O Lethbridge/Laganiere 2001 Chapter 2: Review of object Orientation

© Lethbridge/Laganière 2001 Chapter 2: Review of Object Orientation 5 2.2 Classes and Objects Object • A chunk of structured data in a running software system • Has properties —Represent its state • Has behaviour —How it acts and reacts —May simulate the behaviour of an object in the real world

Objects Jan date of birth: 1955/02/02 address 9 9 UML St position: Manager Savings Account 1287 Greg: date of birth: 1970/01/01 opened:199703/03 ddress: 75 Object Di Margaret: date of birth: 1980/03/03 Mortgage Account 29865 address: 150 C++ Rd position: Teller opened:200008/12 property: 75 Object Dr. Transaction 487. amount: 200.00 time:200109/0114:30 Instant Teller 876 location: Java valley cafe www.lloseng.com O Lethbridge/Laganiere 2001 Chapter 2: Review of object Orientation

© Lethbridge/Laganière 2001 Chapter 2: Review of Object Orientation 6 Objects Margaret: date of birth: 1980/03/03 position: Teller Transaction 487: amount: 200.00 time: 2001/09/01 14:30 Greg: date of birth: 1970/01/01 address: 75 Object Dr. Mortgage Account 29865: balance: 198760.00 opened: 2000/08/12 property: 75 Object Dr. Instant Teller 876: location: Java Valley Cafe Savings Account 12876: balance: 1976.32 opened: 1997/03/03 Jane: date of birth: 1955/02/02 position: Manager address: 99 UML St. address: 150 C++ Rd

Classes A class Is a unit of abstraction in an object oriented(Oo) rogram Represents similar objects -Its instances Is a kind of software module -Describes its instances'structure(properties) -Contains methods to implement their behaviour www.lloseng.com O Lethbridge/Laganiere 2001 Chapter 2: Review of object Orientation

© Lethbridge/Laganière 2001 Chapter 2: Review of Object Orientation 7 Classes A class: • Is a unit of abstraction in an object oriented (OO) program • Represents similar objects —Its instances • Is a kind of software module —Describes its instances’ structure (properties) —Contains methods to implement their behaviour

Is Something a class or an Instance? Something should be a class if it could have instances Something should be an instance if it is clearly a single member of the set defined by a class Film Class: instances are individual films Reel of film: Class: instances are physical reels Film reel with serial number sw19876 Instance of reeloffilm Science fiction Instance of the class Genre Science fiction film · Class: instances include‘ Star Wars Showing of Star Wars'in the phoenix cinema at 7p.m Instance of ShowingofFilm www.lloseng.com O Lethbridge/Laganiere 2001 Chapter 2: Review of object Orientation 8

© Lethbridge/Laganière 2001 Chapter 2: Review of Object Orientation 8 Is Something a Class or an Instance? • Something should be a classif it could have instances • Something should be an instance if it is clearly a singlemember of the set defined by a class Film • Class; instances are individual films. Reel of Film: • Class; instances are physical reels Film reel with serialnumber SW19876 • Instance of ReelOfFilm Science Fiction • Instance of the class Genre. Science FictionFilm • Class; instancesinclude ‘Star Wars’ Showing of ‘Star Wars’in the Phoenix Cinema at 7 p.m.: • Instance of ShowingOfFilm

Naming classes Use capital letters e.g. BankAccount not bankAccount Singular nouns Use the right level of generality E. g Municipality, not city Make sure the name has only one meaning - E.g. bus' has several meanings www.lloseng.com O Lethbridge/Laganiere 2001 Chapter 2: Review of object Orientation

© Lethbridge/Laganière 2001 Chapter 2: Review of Object Orientation 9 Naming classes • Use capital letters —E.g. BankAccount not bankAccount • Use singular nouns • Use the right level of generality —E.g. Municipality, not City • Make sure the name has only one meaning —E.g. ‘bus’ has several meanings

2.3 Instance variables Variables defined inside a class corresponding to data present in each instance · Attributes Simple data - E.g. name, dateOfBirth · Associations -Relationships to other important classes -E.g. supervisor, coursesTaken More on these in Chapter 5 www.lloseng.com O Lethbridge/Laganiere 2001 Chapter 2: Review of object Orientation

© Lethbridge/Laganière 2001 Chapter 2: Review of Object Orientation 10 2.3 Instance Variables Variables defined inside a class corresponding to data present in each instance • Attributes —Simple data —E.g. name, dateOfBirth • Associations —Relationships to other important classes —E.g. supervisor, coursesTaken —More on these in Chapter 5

点击下载完整版文档(PPT)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
共45页,可试读15页,点击继续阅读 ↓↓
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有