Fundamentals of Object Technology Roman Kontchakov Birkbeck, - - PowerPoint PPT Presentation

fundamentals of object technology
SMART_READER_LITE
LIVE PREVIEW

Fundamentals of Object Technology Roman Kontchakov Birkbeck, - - PowerPoint PPT Presentation

Information Systems Concepts Fundamentals of Object Technology Roman Kontchakov Birkbeck, University of London Based on Appendix of Maciaszek, L.A.: Requirements Analysis and System Design (3rd Edition) Addison Wesley, 2007. Outline Object


slide-1
SLIDE 1

Information Systems Concepts

Fundamentals of Object Technology

Roman Kontchakov

Birkbeck, University of London

Based on Appendix of Maciaszek, L.A.: Requirements Analysis and System Design (3rd Edition) Addison Wesley, 2007.

slide-2
SLIDE 2

Outline

Object Class Association Aggregation and Composition Generalization Inheritance Polymorphism

ISC 2018-R 1

slide-3
SLIDE 3

Object: State, Behaviour & Identity

NB: equal = identical

Booch, G.: Object Oriented Analysis and Design with Applications (2nd Edition) Addison-Wesley, 1994

ISC 2018-R 2

slide-4
SLIDE 4

Class

Class represents a set of objects that share a common structure and a common behaviour Objects are instances

  • f classes

Booch, G.: Object Oriented Analysis and Design with Applications (2nd Edition) Addison-Wesley, 1994

ISC 2018-R 3

slide-5
SLIDE 5

Objects: UML Notation

c1: Module

module code = COIY016H4 module name = Information Systems Concepts

  • bject-name: class-name

attribute-name = value

NB: ‘:Module’ is an anonymous instance of class Module NB: ‘c1’ is an object without a specified class NB: there is no compartment for operations!

ISC 2018-R 4

slide-6
SLIDE 6

Classes: UML Notation

Purchase

id: Integer date: Date value: Currency reorder(product: Product)

class name attribute names and types

  • peration signatures

ISC 2018-R 5

slide-7
SLIDE 7

Abstraction

Abstraction focuses upon the essential characteristics

  • f some object,

relative to the perspective

  • f the viewer

Booch, G.: Object Oriented Analysis and Design with Applications (2nd Edition) Addison-Wesley, 1994

ISC 2018-R 6

slide-8
SLIDE 8

Encapsulation

Encapsulation hides the details

  • f the implementation
  • f an object

Booch, G.: Object Oriented Analysis and Design with Applications (2nd Edition) Addison-Wesley, 1994

ISC 2018-R 7

slide-9
SLIDE 9

Operations (in Communication Diagrams)

:Order :Shipment :Stock :Purchase

↓ 1: shipOrder(order: Order) → 1.1: getProducts(order: Order) → 1.1.1: checkLevels() ↓ 1.1.2: reorder(product: Product)

ISC 2018-R 8

slide-10
SLIDE 10

Operations (in Class Diagrams)

Order Shipment

shipOrder(order: Order)

Product Stock

getProducts(order: Order) checkLevels()

Purchase

reorder(product: Product)

ISC 2018-R 9

slide-11
SLIDE 11

Associations

Order

id: Integer date: Date value: Currency

Shipment

id: String date: Date carrier: String shipOrder(order: Order) ◮ Order Shipment 1 1..*

multiplicity: 0..1

  • none or one

0..*

  • any number

1..*

  • at least one

n

  • exactly n

ISC 2018-R 10

slide-12
SLIDE 12

Association Classes

ModuleOffering Student

◭ Module Taken 0..* 0..*

Assessment

marks: List totalMark: Number grade: String

ISC 2018-R 11

slide-13
SLIDE 13

Composition & Aggregation

Aggregation: by reference (transitive and asymmetric)

Crate Bottle

◮ contains 0..1 0..*

Composition: by value (transitive, asymmetric and existence-dependant)

Book Chapter Section

◮ contains 1 1..* ◮ contains 1 1..*

ISC 2018-R 12

slide-14
SLIDE 14

Generalization

A subclass inherits the structure and behavior

  • f its superclass

Booch, G.: Object Oriented Analysis and Design with Applications (2nd Edition) Addison-Wesley, 1994

ISC 2018-R 13

slide-15
SLIDE 15

Inheritance in Java

Person

name: String dob: Date age(): Integer

Employee

startDate: Date leaveEntitlement: Integer leaveTaken: Integer remainingLeave(): Integer public class Person { private String name; private Date dob; public int age(){ return getYear()

  • getYear(dob);

} } public class Employee extends Person { private Date startDate; private int leaveEntitlement; private int leaveTaken; public int remainingLeave(){ return leaveEntitlement - leaveTaken; } }

ISC 2018-R 14

slide-16
SLIDE 16

Polymorphism in Java

Employee

startDate: Date leaveEntitlement: Integer leaveTaken: Integer remainingLeave(): Integer

Manager

leaveSupplement: Integer remainingLeave(): Integer public class Manager extends Employee { private int leaveSupplement; public int remainingLeave(){ int l = super.remainingLeave(); return l + (leaveSupplement); } }

ISC 2018-R 15

slide-17
SLIDE 17

Take Home Messages

Each object has a state, behaviour and identity Class defines attributes and operations There are three kinds of relationships between classes:

association, aggregation/composition and generalization

Generalization provides basis for inheritance and polymorphism

ISC 2018-R 16