fundamentals of object technology
play

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


  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.

  2. Outline Object Class Association Aggregation and Composition Generalization Inheritance Polymorphism ISC 2018-R 1

  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

  4. Class Class represents a set of objects that share a common structure and a common behaviour Objects are instances of classes Booch, G.: Object Oriented Analysis and Design with Applications (2nd Edition) Addison-Wesley, 1994 ISC 2018-R 3

  5. Objects: UML Notation c1: Module object-name : class-name module code = COIY016H4 attribute-name = value module name = Information Systems Concepts 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

  6. Classes: UML Notation Purchase class name id: Integer attribute names and types date: Date value: Currency operation signatures reorder(product: Product) ISC 2018-R 5

  7. Abstraction Abstraction focuses upon the essential characteristics of some object, relative to the perspective of the viewer Booch, G.: Object Oriented Analysis and Design with Applications (2nd Edition) Addison-Wesley, 1994 ISC 2018-R 6

  8. Encapsulation Encapsulation hides the details of the implementation of an object Booch, G.: Object Oriented Analysis and Design with Applications (2nd Edition) Addison-Wesley, 1994 ISC 2018-R 7

  9. Operations (in Communication Diagrams) :Order → 1.1.1: checkLevels() ↓ 1: shipOrder(order: Order) :Shipment :Stock → 1.1: getProducts(order: Order) ↓ 1.1.2: reorder(product: Product) :Purchase ISC 2018-R 8

  10. Operations (in Class Diagrams) Stock Order getProducts(order: Order) checkLevels() Shipment Purchase shipOrder(order: Order) reorder(product: Product) Product ISC 2018-R 9

  11. Associations Shipment Order id: String id: Integer ◮ Order Shipment date: Date date: Date 1 1..* carrier: String value: Currency shipOrder(order: Order) multiplicity: 0..1 0..* 1..* n ���� ���� ���� ���� none or one any number at least one exactly n ISC 2018-R 10

  12. Association Classes ModuleOffering Student ◭ Module Taken 0..* 0..* Assessment marks: List totalMark: Number grade: String ISC 2018-R 11

  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 ◮ contains 1 1..* 1 1..* ISC 2018-R 12

  14. Generalization A subclass inherits the structure and behavior of its superclass Booch, G.: Object Oriented Analysis and Design with Applications (2nd Edition) Addison-Wesley, 1994 ISC 2018-R 13

  15. Inheritance in Java Employee Person startDate: Date name: String leaveEntitlement: Integer dob: Date leaveTaken: Integer age(): Integer remainingLeave(): Integer public class Person public class Employee extends Person { { private String name; private Date startDate; private Date dob; private int leaveEntitlement; private int leaveTaken; public int age() { return getYear() public int remainingLeave() { - getYear(dob); return leaveEntitlement - leaveTaken; } } } } ISC 2018-R 14

  16. Polymorphism in Java Employee Manager startDate: Date leaveEntitlement: Integer leaveSupplement: Integer leaveTaken: Integer remainingLeave(): 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

  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

Recommend


More recommend