Week1 IntroToOO

Embed Size (px)

Citation preview

  • 8/7/2019 Week1 IntroToOO

    1/24

    1

    Introduction to Object Orientation

  • 8/7/2019 Week1 IntroToOO

    2/24

    2

    Objectives: Introduction to Object Orientation

    Understand the basic principles of object orientationUnderstand the basic principles of object orientation

    Define the basic concepts and terms of object orientationDefine the basic concepts and terms of object orientation

    Discuss the strengths of object orientationDiscuss the strengths of object orientation

  • 8/7/2019 Week1 IntroToOO

    3/24

    3

    Introduction to Object Orientation Topics

    Basic Principles of Object OrientationBasic Principles of Object Orientation

    Basic Concepts of Object OrientationBasic Concepts of Object Orientation

  • 8/7/2019 Week1 IntroToOO

    4/24

    4

    Basic Principles of Object Orientation

    Object Orientation

    Enc

    apsulation

    Ab

    straction

    H

    ierarchy

    M

    odularity

  • 8/7/2019 Week1 IntroToOO

    5/24

    5

    What is Abstraction?

    Customer

    Salesperson

    Product

  • 8/7/2019 Week1 IntroToOO

    6/24

    6

    What is Encapsulation?

    Hide implementation from clientsHide implementation from clients

    Clients depend on interface

  • 8/7/2019 Week1 IntroToOO

    7/24

    7

    What is Modularity?

    The breaking up of something complex into manageableThe breaking up of something complex into manageablepiecespieces

    Order Processing

    System

    Billing

    OrderEntry

    Order

    Fulfillment

  • 8/7/2019 Week1 IntroToOO

    8/24

    8

    What is Hierarchy?

    Decreasing

    abstraction

    Increasing

    abstraction

    Asset

    RealEstate

    Savings

    BankAccount

    Checking Stock

    Security

    Bond

    Classes at the same level of the hierarchyshould be at the same level of abstraction

    Levels of abstractionLevels of abstraction

  • 8/7/2019 Week1 IntroToOO

    9/24

    9

    Introduction to Object Orientation Topics

    Basic Principles of Object OrientationBasic Principles of Object Orientation

    Basic Concepts of Object OrientationBasic Concepts of Object Orientation

  • 8/7/2019 Week1 IntroToOO

    10/24

    10

    Basic Concepts of Object Orientation

    ObjectObject

    ClassClass

    AttributeAttribute OperationOperation

    ComponentComponent

    GeneralizationGeneralization

    PolymorphismPolymorphism

  • 8/7/2019 Week1 IntroToOO

    11/24

    11

    What is an Object?

    BehaviorBehavior

    StateState

    Unique identityUnique identityEnglish 101

    Geology 110

    Geology 110World History 200

    Algebra 110Music History 200

    Intro to OO 180

  • 8/7/2019 Week1 IntroToOO

    12/24

    12

    What is a Class?

    An object is defined by a classAn object is defined by a class

    English 101

    Geology 110

    Geology 110World History 200

    Algebra 110Music History 200

    Intro to OO 180

    CourseOffering

  • 8/7/2019 Week1 IntroToOO

    13/24

    13

    What is an Attribute?

    :CourseOffering

    number = 101

    startTime = 900

    endTime = 1100

    :CourseOffering

    Name = 104

    startTime = 1300endTime = 1500

    CourseOffering

    number

    startTime

    endTime

    Class

    Attribute

    Object

    Attribute Value

  • 8/7/2019 Week1 IntroToOO

    14/24

    14

    What is an Operation?

    CourseOffering

    addStudent

    deleteStudent

    getStartTime

    getEndTime

    Class

    Operation

  • 8/7/2019 Week1 IntroToOO

    15/24

    15

    A nonA non--trivial, nearly independent, and replaceable part of atrivial, nearly independent, and replaceable part of asystem that fulfills a clear function in the context of a wellsystem that fulfills a clear function in the context of a well--defined architecturedefined architecture

    Component Name

    Component

    Name

    What Is A Component?

    Design Model Implementation Model

    Component

    Interface

    Component

    Interface

  • 8/7/2019 Week1 IntroToOO

    16/24

    16

    What is Generalization?

    One class inherits from anotherOne class inherits from another

    Truck

    tonnage

    GroundVehicle

    weight

    licenseNumber

    Car

    owner

    register( )

    getTax( )

    Person

    0..*

    Trailer

    1

    ancestor

    decendent

    generalization

    size

  • 8/7/2019 Week1 IntroToOO

    17/24

    17

    What is Polymorphism?

    The ability to hide many different implementations behind aThe ability to hide many different implementations behind asingle interfacesingle interface

    Manufactor AManufactor A

    Manufactor C

  • 8/7/2019 Week1 IntroToOO

    18/24

    18

    Strengths of Object Orientation

    A single paradigmA single paradigm

    Single language used by users, analysts, designers,implementers

    Facilitates architectural and code reuseFacilitates architectural and code reuse

    Models more closely reflect the real worldModels more closely reflect the real world

    More accurately describe corporate data and processes Decomposed based on natural partitioning

    Easier to understand and maintain

    StabilityStabilityA small change in requirements does not mean massive

    changes in the system under development

  • 8/7/2019 Week1 IntroToOO

    19/24

    19

    A Simple Sales Order Example

    Order

    Product

    Ship via

  • 8/7/2019 Week1 IntroToOO

    20/24

    20

    Class Diagram for the Sales Example

    Salesperson Product

    Sale

    Corporate

    Customer

    Individual Truck

    Vehicle

    Train

  • 8/7/2019 Week1 IntroToOO

    21/24

  • 8/7/2019 Week1 IntroToOO

    22/24

    22

    Introduction to Object Orientation Topics

    Basic Principles of Object OrientationBasic Principles of Object Orientation

    Basic Concepts of Object OrientationBasic Concepts of Object Orientation

  • 8/7/2019 Week1 IntroToOO

    23/24

    23

    Review: Introduction to Object Orientation

    What are the four basic principles of object orientation?What are the four basic principles of object orientation?Provide a brief description of each.Provide a brief description of each.

    What is an Object and what is a Class? What is theWhat is an Object and what is a Class? What is thedifference between them?difference between them?

    What is an Attribute?What is an Attribute?

    What is an Operation?What is an Operation? What is generalization?What is generalization?

    What is polymorphism?What is polymorphism?

    Describe the strengths of object orientation.Describe the strengths of object orientation.

  • 8/7/2019 Week1 IntroToOO

    24/24

    24

    REFERENCES

    OOAD Using the UML - Introduction to Object Orientation, v 4.0

    Copyright 1994-1998 Rational Software, all rights reserved