Lecture 3.1 Introduction to OOAD

download Lecture 3.1 Introduction to OOAD

of 19

Transcript of Lecture 3.1 Introduction to OOAD

  • 8/4/2019 Lecture 3.1 Introduction to OOAD

    1/19

    Object-orienAnalysis and Des

    u

  • 8/4/2019 Lecture 3.1 Introduction to OOAD

    2/19

    OO Analysis and Design - 2

    References

    Object-Oriented Analysis and Design withApplications (2nd Edition)

    Grady Booch

    Addison-Wesley Professional

    Thinking in Java

    Bruce Eckel

    Freely downloadable athttp://www.mindview.net/Books/TIJ/

  • 8/4/2019 Lecture 3.1 Introduction to OOAD

    3/19

    OO Analysis and Design - 3

    Object-oriented Analysis

    Object-oriented Analysis is concerned withdeveloping software requirements andspecifications that are expressed

    in terms of objects

    instead of to the traditional data or functionalviews of systems

  • 8/4/2019 Lecture 3.1 Introduction to OOAD

    4/19

    OO Analysis and Design - 4

    Complexity

    Is an essential property of any computer-based system

    Why?

    Problem to be solved might be very complex

    Issues in project management

    Software is perceived as being very malleableetc.

  • 8/4/2019 Lecture 3.1 Introduction to OOAD

    5/19

    OO Analysis and Design - 5

    Managing complexity

    Is difficult

    Our brain can only focus on 72 things at a time

    The solution is to

    Decompose the problem into abstractions

    And hierarchise those abstractions

  • 8/4/2019 Lecture 3.1 Introduction to OOAD

    6/19

    OO Analysis and Design - 6

    Obect-Oriented Design

    Object-oriented design is concerned withdeveloping an Object-Oriented model of asoftware system to implement the identified

    requirements and specificationsidentified during Object-Oriented Analysis

  • 8/4/2019 Lecture 3.1 Introduction to OOAD

    7/19

    OO Analysis and Design - 7

    Object-Oriented Design

    Is both artistic and scientific

    The final objective is to produce a model

    RequiresA notationUML = Unified Modeling Language

    A methodology

    UP = Unified Process (or, rather, Simplified UP)

    Tools

  • 8/4/2019 Lecture 3.1 Introduction to OOAD

    8/19

    OO Analysis and Design - 8

    The object

    Has

    An identity

    A parallel can be made with the primary key concept

    A stateSet of all the private attributes of the object

    A behaviour

    How does the object react when receiving a message?

  • 8/4/2019 Lecture 3.1 Introduction to OOAD

    9/19

    OO Analysis and Design - 9

    An Object-Oriented model

    Has the following essential caracteristics

    Abstraction = class

    Encapsulation

    Two types of hierarchies

    has-a = association

    is-a = inheritance

  • 8/4/2019 Lecture 3.1 Introduction to OOAD

    10/19

    OO Analysis and Design - 10

    Abstraction = class

    Template from which objects are created(instanciation)

    Only relevant details are taken into account

    Hence abstraction

    We focus only on the behaviour

    we do not care about the state (private attributes)

    we care about the interface (public methods)

  • 8/4/2019 Lecture 3.1 Introduction to OOAD

    11/19

    OO Analysis and Design - 11

    Encapsulation

    Implementation is hidden

    Attributes are not visible from the outside

    Decoupling the interface from the implementation

  • 8/4/2019 Lecture 3.1 Introduction to OOAD

    12/19

    OO Analysis and Design - 12

    Has-a hierarchy : association

    *

    1

  • 8/4/2019 Lecture 3.1 Introduction to OOAD

    13/19

    OO Analysis and Design - 13

    Importance of association

    Main caracteristics

    Shows that an object from one class possesses oruses object(s) from another class

    The lifetime of participating objects are notnecessarily linked

    Somewhat similar in relationships in the ER model

    One important difference is that the relationship can beunidirectional when doing OO modeling

  • 8/4/2019 Lecture 3.1 Introduction to OOAD

    14/19

    OO Analysis and Design - 14

    Has-a hierarchy : aggregation

    *

    1

  • 8/4/2019 Lecture 3.1 Introduction to OOAD

    15/19

    OO Analysis and Design - 15

    Importance of aggregation

    Main features

    Shows that some object can contain other objects

    The lifetime of the participating objects are linked

    In fact, they are the same

    That is, when the controlling object is destroyed, anyenclosed object is also destroyed

  • 8/4/2019 Lecture 3.1 Introduction to OOAD

    16/19

    OO Analysis and Design - 16

    Is-a hierarchy : inheritance

  • 8/4/2019 Lecture 3.1 Introduction to OOAD

    17/19

    OO Analysis and Design - 17

    Importance of inheritance

    Factoring behaviour

    Creates an easily extensible model

    Redefinitions are possibleOverloading is possible

    POLYMORPHISM becomes possible

    This is the most imporant aspect of OO

    All OO models must exhibit inheritance

  • 8/4/2019 Lecture 3.1 Introduction to OOAD

    18/19

    OO Analysis and Design - 18

    Polymorphism

  • 8/4/2019 Lecture 3.1 Introduction to OOAD

    19/19

    OO Analysis and Design - 19

    Importance of polymorphism

    Make the software

    Simpler to write

    Simpler to maintain and evolve

    80% of existing programmers only do maintenance

    Better performance because of compactness ofcode

    Complete example of an OO modelClasses (and associated methods and attributes)used in a simulation of a solar system