Chapter_4_new_

Chapter_4_new_ - Chapter 4 Object Oriented Paradigm Chapter...

Info iconThis preview shows pages 1–16. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 4 Object Oriented Paradigm
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Chapter 4 Objectives Introduce concepts of OO software architecture Describe a complete OO analysis and design process Discuss general design principles in the context of OO design
Background image of page 2
Agenda Introduction to OOP OOP Principles Generic Principles Lessons learned Review Questions An OOP practice in Study case OO Analysis OO Design
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Introduction What is OO? Object Oriented (programming, design, . ..) History dated back to 1960’s Shadowed by structured programming in 70’s Popular since 1980’s
Background image of page 4
OO SE – A Broader Concept OO Software Engineering OO Analysis OO Design OO Programming We concentrate on OO Design in this class
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
OO Principles Three Principles Encapsulation Inheritance Polymorphism
Background image of page 6
Encapsulation Given a class, outside world See its interface (functional specification) But not implementation details Examples? C++. Interface defined in header file. Benefits? Allows flexibility. Allows team working.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Inheritance A class can inherit from its base class Example: design a car engine controller You’ve already got ignition timing, throttle position sensor, emission control – quite complex a system. Now your boss ask you to design a new model with “cruise control”. What shall you do? Design a new class and inherit from the old design! But why not directly do a copy and paste?
Background image of page 8
Polymorphism Poly Poly – multiple Morph Morph – form Polymorphism Polymorphism – an object can have different appearance/behaviors under different circumstances Example: graphical object system When you have a linked list of graphic objects How do you draw them out in C++, Java, and C#?
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Class Class consists of Public interface Detailed implementation Definition of class usually consists of “name” of the class Possibly included in a package or namespace List of attributes List of operations Special operations: constructor, destructor, etc.
Background image of page 10
Accessibility Principle When assigning accessibility of an attribute (operation): Expose as least information as possible! Example: User needs to QuotePrice() QuotePrice() should be public However, the processingCost() should not be exposed because of commercial secret
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Relationship Among Classes Very Complex! A partial list of relationships: Composition Aggregation Association Inheritance ...
Background image of page 12
Composition Relation An object is composed of other object (Whole/Part relationship) Example: a car consists of Chassis Window Shield Engine Transmission Requirement: the life span of “components” and “owner” involved in a composition relationship must be same
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Aggregation Similar to composition (but more relaxed) Less restrictive on the “life span ” of “owner” and “components”
Background image of page 14
Compositon & Aggregation Example Composition Aggregation
Background image of page 15

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 16
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 82

Chapter_4_new_ - Chapter 4 Object Oriented Paradigm Chapter...

This preview shows document pages 1 - 16. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online