object oriented modeling concepts and principles

Upload: haveit12

Post on 30-May-2018

232 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    1/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 1

    OBJECT ORIENTED

    MODELING, CONCEPTS

    AND PRINCIPLES

    Chapter 19

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    2/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 2

    CONTENTS

    What is object-oriented development ?

    Object-oriented process model

    Object-oriented concepts

    Object modeling technique

    Unified Modeling Language (UML)

    Concepts and Principles of Object Modeling

    Object-oriented vs functional approach

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    3/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 3

    What is OO Development ?New way of thinking about problems using

    models organized around real world concepts.

    The fundamental construct is the object Combines both data structure and operations in asingle entity called an object.

    Leads to reuse, faster software development

    and higher quality programs.Easier to maintain

    Structure inherently decoupled

    Fewer side-effects

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    4/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 4

    The OO process modelMoves through an evolutionary spiralEmphasizes development of reuse capability

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    5/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 5

    Object Oriented ConceptsObjects and Object Model

    Object: Data and operations relevant to some

    real world or significant program entity

    encapsulated into a monolithic unit accessibleonly through a well defined interface. For ex.

    File in the file system together with operations

    such as open, close, read, & write,

    Object Model: Describes the structure of theobjects in the system

    their identity, relationships to other objects,

    attributes and operations.

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    6/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 6

    Classification & Classes A class describes a group of objects with

    similar properties (attributes), commonbehavior (operations), common relationships to

    other objects, and common semantics.

    Object Modeling

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    7/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 7

    Object Classes

    Thus, a class is an abstraction that describes

    relevant properties and hides the rest.

    Represented diagrammatically as below.

    Class Name

    Attributes

    Operations

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    8/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 8

    Object Modeling

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    9/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 9

    Object Modeling

    Attributes: An attribute is a data value held

    by the objects in a class. Name, age, and

    weightare attributes ofPerson objects.

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    10/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 10

    Object Modeling

    Operations and Methods : Operations : An operation is a function or

    transformation that may be applied to or by

    objects in a class. Each operation has a targetobject as an implicit argument. The behavior of

    the operation depends on the class of its target.

    Methods : A methodis the implementation of an

    operation for a class.Categories: 1) manipulate data, 2) perform

    computation, and 3) monitor for occurrence of

    controlling event.

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    11/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 11

    An operation may have arguments in addition to

    its target object. Such arguments parameterize the

    operation but do not affect the choice of method.

    Object Modeling

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    12/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 12

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    13/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 13

    Class and Instance

    Polygon

    VerticesBorder Color

    Fill Color

    DrawErase

    Move

    Polygon

    v={(0,0),(0,1),(1,0)}BC = Red

    FC = Blue

    DrawErase

    Move

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    14/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 14

    Abstraction and Encapsulation

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    15/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 15

    Abstraction Isolate those aspects that are important and

    suppress (or hide) those that are unimportant(e.g., representations).

    Focus on what object is and does before

    deciding how it should be implemented.

    Abstraction allows dealing only with

    application domain concepts, not making

    design and implementation decision before

    problem is understood.

    Abstraction and Encapsulation

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    16/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 16

    Encapsulation (Information Hiding)

    Separates the external aspects of an object,which are accessible to other objects, from the

    internal implementation details of the object,

    which are hidden from other objects.

    Combining Data and Operations: The OO approach combines the data structure

    and operations in a single entity.

    Abstraction and Encapsulation

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    17/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 17

    Interfaces

    Does not have an implementation of its own.Other classes provide implementations of it.

    Client classes are only interested in behavior.

    Class Name

    Operations

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    18/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 18

    Inheritance

    Sharing of attributes and operations among

    classes based on hierarchical relationship.

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    19/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 19

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    20/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 20

    Class and Subclass

    Polygon

    VerticesBorder Color

    Fill Color

    DrawErase

    Move

    Right Triangle

    Vertices

    Hypotenuse length

    Border Color

    Fill Color

    DrawErase

    Move

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    21/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 21

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    22/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 22

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    23/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 23

    OperationsPolymorphism

    The same operation may behave differently on

    different classes. E.g., the move operation behavesdifferently on a Window and ChessPiece.

    Operations may be overloadedwhen subclasses

    defined.

    The compiler can distinguish based on the type of the

    operands in method invocations which operation is

    actually needed.

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    24/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 24

    Polymorphism

    Car

    Paint

    Polygon

    Paint

    TrianglePaint

    SquarePaint

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    25/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 25

    Communication

    Message: [destination, operation, params]

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    26/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 26

    What Does OO Mean?Pressman (Coad & Yourdon)

    Objects (identity)

    Classification

    Inheritance

    Communication

    Rumbaugh Objects (identity)

    Classification

    Inheritance

    Polymorphism

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    27/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 27

    Object Modeling TechniqueObject modeling technique (OMT) extends

    from analysis thru design to implementation

    Analysis model contains objects found in

    the application domain, including properties

    of object and their operations.

    These application domain objects form aframework to the design model.

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    28/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 28

    The sameseamless notation is used from

    analysis to design to implementation.

    The system is modeled using three related

    but different view points. Object Model : Represents the static, structural,

    data aspects of the system.

    Dynamic Model : Represents the temporal,

    behavioral, control aspects of the system.

    Functional Model : Represents transformational,

    functional aspects of the system.

    Object Modeling Technique

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    29/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 29

    Object Modeling

    Links and Associations

    Link: A physical or conceptual connection between

    instances. E.g., Joe Smith Works-forSimplex

    company. Mathematically, a tuple, i.e., an orderedlist of object instances. A link is an instance of an

    association.

    Associations : A group of links with common

    structure and semantics. E.g., a person Worksfora

    company. All the links in an association connect

    objects from the same classes.

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    30/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 30

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    31/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 31

    Object Modeling

    Multiplicity: Specifies how many instances of one class may

    relate to a single instance of an associated class

    Role Names: One end of an association. Binary association

    has two roles.

    Link attributes

    May be defined for associations, e.g., if theassociation is uses, the link attribute might be

    one of permission.

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    32/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 32

    Binary Association & Multiplicity

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    33/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 33

    Ternary Association

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    34/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 34

    Link Associations

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    35/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 35

    AggregationA part-whole ora-part-of relationship

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    36/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 36

    OO Software ProcessFramework

    Identify major classes and connections.

    Do enough design to ensure they are implementable

    Extract reusable components and build prototype. Test to uncover errors and get customer feedback.

    Iterate on design and refine it.

    Engineer special objects (not in library).

    Assemble a new prototype. Test and obtain customer feedback.

    Iterate until satisfactory product obtained.

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    37/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 37

    OO MetricsBecause of reuse, LOC not so useful# of Scenario scripts, each a triplet of the form

    [initiator, action, participant], where

    Initiator = object initiating a request

    action = result of request (method invocation)

    participant = server object satisfying request

    # of key [highly independent] classes# of support classes (and ave. per key class)

    # of subsystems

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    38/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 38

    Possible Estimating Approach

    Develop scenario scripts and estimate count

    Determine the number of key classes

    Categorize key classes

    Interface type Multiplier

    No GUI 2.0

    Text-based user int. 2.25GUI 2.5

    Complex GUI 3.0

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    39/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 39

    Possible Estimating ApproachEstimate # of support classes by multiplying

    # key classes in each category by multiplier

    Estimate # of person-days per class, e.g.,

    15-20

    Estimate the number of major iterations

    There should be a contract deliverable foreach major iteration

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    40/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 40

    OO Progress TrackingThis needs to be done for each iteration (see

    text for list of specifics in each category)

    OO analysis completed

    OO design completed

    OO programming completed

    OO testing completed

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    41/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 41

    Object-Oriented vs Structured Approach

    Easier to maintain

    Combines data

    structure and behaviorin a single entity

    Emphasizes object

    structure

    Reuse more readilyaccomplished

    Harder to maintain

    May separate data and

    behavior Emphasizes

    procedural structure

    Reuse limited, hence

    possible delay insoftware construction

  • 8/9/2019 Object Oriented Modeling Concepts and Principles

    42/42

    Chapter 19 -- Assistance -- Lamimi V. KamatFebruary 14, 1999 R. A. Volz 42

    Object-Oriented vs Structured Approach

    Strong cohesion and

    weak coupling

    Encapsulation,Inheritance and

    Polymorphism are

    strong features of OO

    software development

    Harder to achieve

    weak Coupling and

    strong cohesion Some languages

    support encapsulation

    and polymorphism,

    but rarely inheritance