Basic Concepts of OO

Embed Size (px)

Citation preview

  • 7/29/2019 Basic Concepts of OO

    1/15

    Basic Concepts of

    Object Orientation

    Object-Oriented Analysis

    CIM2566

    Bavy LI

  • 7/29/2019 Basic Concepts of OO

    2/15

    Basic Concepts of OO 2Prepared by: Bavy LI

    What is Object-Orientation?

    Object-orientation is the use ofobjects andclasses in analysis, design, and programming.

    The use of objects distinguishes object-orientation from other techniques such as traditional structured methods (process-based:

    data and function are separate)

    knowledge based systems (logic programming:Prolog)mathematical methods (functional programming:

    Scheme).

  • 7/29/2019 Basic Concepts of OO

    3/15

    Basic Concepts of OO 3Prepared by: Bavy LI

    Why did OO Arise?

    Modeling in analysis and software design andlanguages for programming originally focusedon process. But many results indicated the

    process approach was problematic and led tothe software crisis.

    Hierarchical Functional Decomposition

    Top-Down Design (TDD)

    What are the advantages/disadvantages of TDD?

  • 7/29/2019 Basic Concepts of OO

    4/15

    Basic Concepts of OO 4Prepared by: Bavy LI

    Why does Organization need

    Object-Orientation? Organizationally, OO provides a superior means

    of: Problem/Business Analysis and Requirements

    Better Software Development/Modern programmingpractice

    Superior Software Engineering Metrics

    Web Presence and Utilization

    Software Reuse Software Use

    Enterprise Engineering

  • 7/29/2019 Basic Concepts of OO

    5/15

    Basic Concepts of OO 5Prepared by: Bavy LI

    Terminology 1

    OOA Object Oriented Analysisanalyzing your problem by decomposition into

    objects OOD Object Oriented Designdesigning your code into objects

    OOP Object Oriented Programmingprogramming using the concepts of object

    orientation

  • 7/29/2019 Basic Concepts of OO

    6/15

    Basic Concepts of OO 6Prepared by: Bavy LI

    Terminology 2

    Class a design (like a blueprint for a house) of an object that

    contains data and methods

    Object an instance (like a particular house with a street

    address) of a class with a unique identity

    Abstraction only exposing the important, relevant qualities of an

    object or system

  • 7/29/2019 Basic Concepts of OO

    7/15

    Basic Concepts of OO 7Prepared by: Bavy LI

    Terminology 3

    Attribute

    a named property of an object capable of holding

    state, as similar as instance variables or datamembers

    Method

    an operation on an object, also called a function or

    operation

  • 7/29/2019 Basic Concepts of OO

    8/15

    Basic Concepts of OO 8Prepared by: Bavy LI

    What are the Primary Object-

    Oriented Languages Today? C++ added classes to C as early as 1985

    A hybrid object-oriented languages with powerfulfeatures including multiple inheritance, exceptions,

    templates, operator overloading etc

    Java was created as a simplification of C++ thatcould run on any machine, providing a write-once/run anywhere capability.

    EJB 2.0 is the new standard for the J2EE, orJava 2 Platform, Enterprise Edition

  • 7/29/2019 Basic Concepts of OO

    9/15

    Basic Concepts of OO 9Prepared by: Bavy LI

    What are the Primary Object-

    Oriented Methodologies Today? The Unified Modeling Language, orUML,

    has become the industry standard design

    and analysis notation, which lends itself toa methodology.

  • 7/29/2019 Basic Concepts of OO

    10/15

    Basic Concepts of OO 10Prepared by: Bavy LI

    What are the Benefits Of Object-

    Orientation? Reuse, quality, an emphasis on modeling the

    real world, a consistent OOA/OOD/OOPpackage, naturalness (our "object concept"),resistance to change, encapsulation andabstraction, and etc.

    On resistance to change, system objects changeinfrequently while processes and procedures(top-down) are frequently changed.

  • 7/29/2019 Basic Concepts of OO

    11/15

    Basic Concepts of OO 11Prepared by: Bavy LI

    Big Three (and a half)

    The three and a half key ingredients of

    OOP are

    Encapsulation,

    Inheritance,

    Polymorphism, and

    Message Passing

  • 7/29/2019 Basic Concepts of OO

    12/15

    Basic Concepts of OO 12Prepared by: Bavy LI

    Encapsulation

    hides implementation, shows only

    interface

    "Encapsulation is the process of hiding all of

    the details of an object that do not contribute

    to its essential characteristics." Booch

  • 7/29/2019 Basic Concepts of OO

    13/15

    Basic Concepts of OO 13Prepared by: Bavy LI

    Inheritance

    IS A relationship

    A new class can be created by "Inheriting"from another class or multiple classes.

    The new class inherits methods and datamembers of the "parent" class.

    This is also called "extending" the base class,or "sub-classing".

  • 7/29/2019 Basic Concepts of OO

    14/15

    Basic Concepts of OO 14Prepared by: Bavy LI

    Message Passing

    a message is an invocation of a method

    on an object

    "an object-oriented program is a bunch of

    objects laying around sending messages to

    one another."

  • 7/29/2019 Basic Concepts of OO

    15/15

    Basic Concepts of OO 15Prepared by: Bavy LI

    Polymorphism

    the ability to hide many different

    implementations behind a single interface.

    When objects respond differently to thesame message this is a form of

    Polymorphism.