Day1_OOAD & UML.ppt [Compatibility Mode]

Embed Size (px)

Citation preview

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    1/62

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    Instructor:

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    2/62

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    3/62

    General IntroductionObject Oriented Software Development

    Object-Oriented Methodologydevelopment approach used to build complex systems using

    the concepts of object, class, polymorphism, and inheritance

    with a view towards reusability

    encourages software engineers to think of the problem in

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    erms o e app ca on oma n ear y an app y a cons s en

    approach throughout the entire life-cycle

    Object-Oriented Analysis and Design (OOAD)

    analysis models the real-world requirements, independent ofthe implementation environment

    design applies object-oriented concepts to develop and

    communicate the architecture and details of how to meet

    requirements

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    4/62

    General IntroductionSoftware Design

    Design transforms requirements intoan architecture diagram

    subsystems, modules and their relationships

    a detailed design

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    p n r n r , ru ur , n

    algorithms of each module

    Also develops

    a review plan for ensuring the design meets therequirements

    a test plan for ensuring the implementation meets the

    design

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    5/62

    General IntroductionObject-Oriented Analysis 1/2

    Builds a real-world model from requirementsclient interviews

    domain knowledge

    real-world experience

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    Model is more precise and concise than the

    informal problem definition

    The model addresses three aspects of objectsclass structure and relationships

    sequencing of interactions and events

    data transformations and computations

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    6/62

    General IntroductionObject-Oriented Analysis 2/2

    Class Model static structure

    what objects are in the system?

    how are they related?

    Dynamic Model

    Data-Oriented

    Action-Oriented

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    what events occur in the system

    when do they occur and in what

    order?

    Functional Modeldata transformations

    what does the system do

    Both Data and Actions

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    7/62

    General IntroductionOMT & UML (OMT turned into UML)

    OMT [Object Modeling Technique - Rumbaugh et al.,1991]consists of

    building three complementary models of the system

    adding implementation details to the models

    implementing the models

    OMT includes a set of

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    phases [processes]

    diagramming techniques

    OMT has four phases

    object-oriented analysis builds a real-world model system design determines overall architecture of system

    object design decides upon data structures and algorithms

    implementation translates design into programming language

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    8/62

    The Unified Modeling Language (UML) is a standard language for

    Constructin Documentin

    General IntroductionWhat is UML?

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    8

    Business Modeling Communications

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    9/62

    General IntroductionOMT Stages & Models

    Analysis- Model of real-world situation- What ?

    System Design- Overall architecture (sub-systems)

    Object Design

    ObjectModel

    -Staticstructureofobjectsandtheirrelationships

    (objectdiagram) DynamicModel

    -Controlaspectsofthesystem

    (statediagrams)FunctionalModel

    -Datavaluetransforamtions

    (dataflowdiagrams)

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    -- Algorithms/data structures to

    implement each class

    Implementation- Translation of object classes and

    relationships to a particularobject-oriented language

    time

    System

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    10/62

    General IntroductionOO Analysis & Design Steps

    Class Modeling

    Dynamic Modeling

    Functional Modeling

    Add O erations to the Class Model

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    Iterate and refine the models

    After the first iteration, steps may occur in parallel

    or out of orderAll models must be kept in synch as changes are made

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    11/62

    Class Modeling

    Identify objects and classes

    Prepare a data dictionary

    Identify associations between objects

    Identif class attributes and initial set of

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    operations

    Organize object classes using inheritance

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    12/62

    Class ModelingWhat is an object?

    Represent an entity in the real world

    Possesses operation (behavior) and attributes

    data state

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    Operation/BehaviorMethod inside class

    Consists of things that the object know how to do

    Unique Identifiable

    Is a black box which receives messages

    Data contain information describe

    the state of objects

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    13/62

    Class ModelingAbstraction

    Polygon

    Attributes:

    - vertices

    - border color

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    - fill color

    Operations:

    - draw

    - erase

    - move

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    14/62

    Nouns suggest candidate Classes.

    Not every noun is an Object Class.

    Some are attributes of another Class.

    Class ModelingDomain Analysis

    Problem Domain

    Natural Language

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    Some are irrelevant, outside the scope of the application.

    Verb phrases suggest class associations

    Some relationships are irrelevant (caution).

    Proper nouns suggest Objects of a Class type. Beware

    of singular nouns.

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    15/62

    Class ModelingClasses Identifying 1/2

    Class defines methods, variables for a kind of object Class is an abstract description of a set of objects

    We actually write code for a class, not object

    Use class as a blue-print to create (instantiate) an object

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    Polygon

    Attributes:

    - vertices

    - border color

    - fill color

    Operations:

    - draw

    - erase

    - move

    instantiate

    instantiate

    instantiate

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    16/62

    Finding classes:Use domain analysis as before.

    Derive them from the use cases (descriptions).

    Look for data which must be stored or analysed.

    Class ModelingClasses Identifying 2/2

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    Are there external systems?

    Are there any devices under the control of the

    system?

    Are there any organisational parts?

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    17/62

    Class ModelingClasses, Attributes & Operations

    Attributes define the properties of the objects every instance of the class has the same attributes

    an attribute has a data type

    the values of the attributes may differ

    among instances

    O erations define the behavior of the

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    objects

    action performed on or by an object

    available for all instances of the class

    need not be unique among classes

    hand-o

    pitch,

    Class Attributes Operationsball radius, weight catch, throw

    football air pressure pass, kick, hand-o

    baseball liveness hit, pitch,

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    18/62

    Class ModelingAttributes

    Describe the state and characteristics of the object. Must be typed, primitives like integer, real, Boolean,

    point, area, enumeration, these are primitives. May

    be language specific.

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/318

    , .

    Class variables have scope across every instance of

    class, change one changes all (static attributes)

    Syntax visibility name : type-expression = initial-value

    {property-string}

    Only name and type are mandatory.

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    19/62

    Class ModelingOperations

    Operations manipulate attributes and performother tasks.

    Scope is the Class.

    Operation signature is composed of name,

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/319

    parameters and return type. name(parameter-list) return-type-expression

    Scope and visibility rules apply.

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    20/62

    Class ModelingObject Model Notation

    Class NameInstanceVariable1

    InstanceVariable2: type

    Method1()

    Method2(arguments) return type

    Classes are represented as rectangles;

    The class name is at the top, followed by

    attributes (instance variables) and methods

    (operations)

    Depending on context some information can be

    hidden such as types or method arguments

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    (Class Name)

    InstanceVariable1 = value

    InstanceVariable2: type

    Method1()

    Method2(arguments) return type

    Objects are represented as rounded rectangles;

    The objects name is its classname surrounded

    by parentheses

    Instance variables can display the values that

    they have been assigned; pointer types will

    often point (not shown) to the object being

    referenced

    Cl M d li

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    21/62

    Class ModelingEncapsulation

    Allow to show only the important methods asinterface

    Hide detail information

    Hide the data item

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    Access to data item only through member methods

    Cl M d li

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    22/62

    Class ModelingAccess modifiers

    Used for accessibility of data member andmember methods

    Example:

    Private

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    Protected

    Friendly (Java)

    Cl M d li

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    23/62

    Class ModelingInformation Hiding

    Implemented by the Private access modifier

    Hidden methods, member data can only be

    accessed by member methods

    Benefit:

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    Your brains doesnt have to deal with it unless youre

    specifically concerned with it

    When change occurs, the effects are localized

    Cl M d li

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    24/62

    Class ModelingClass Diagram

    Class diagrams show the

    classes of the system, theirinterrelationships (including

    inheritance, aggregation, and

    association), and the

    operations and attributes of

    Name

    Inheritance

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    24

    Attributes

    Operations

    Relations Associations

    Aggregation

    Cl M d li g

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    25/62

    Class ModelingInheritance

    Classes with a set of similar attributes and operationsmay be organized into a hierarchical relationship

    Common attributes and operations are factored out and

    assigned to a broad superclass (generalization)

    eneralization is the is-a relationshi

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    superclasses are ancestors, subclasses are descendants

    A class can be iteratively refined into subclasses that

    inheritthe attributes and operations of the superclass

    (specialization)

    Class Modeling

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    26/62

    Class ModelingOMT Inheritance Notation

    GeneralizationSuperclass

    Class

    Attributes

    Operations

    Ball

    Radius, Weight

    Throw, Catch

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    Specialization

    Subclasses

    Football

    air pressure

    pass, kick, hand-off

    Baseball

    liveness

    hit, pitch, tag

    Basketball

    air pressure , dimples

    shoot, dribble, pass

    Class Modeling

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    27/62

    Class ModelingMultiple & Multilevel Inheritance

    Single inheritance: Inherit from only one superclass

    Multiple inheritance: a class have common

    characteristics with more than one super class

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    Multilevel inheritance :

    Level of inheritance

    hierarchy.

    Class Modeling

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    28/62

    Class ModelingAdvantages of Inheritance

    Development model closer to real life object modelwith hierarchical relationships

    Reusability reuse public methods of base class

    Extensibility Extend the base class

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    derive class cannot change it

    Rapid prototyping

    Class Modeling

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    29/62

    Class ModelingAssociations

    Associations model Class relationships. Associations should be named where

    appropriate. Usual to use verbs from the

    problem domain.

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/329

    Roles played by classes may also be named.

    Associations have a cardinality.

    Rules from programming about sensiblenames apply.

    Class Modeling

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    30/62

    Association Name

    Exactly One

    (default)

    Class1 Class2

    Class

    *

    Class ModelingAssociations & Cardinality

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/330

    Class

    Class

    Class

    ClassZero or more

    Optional (zero or one)

    One or more

    Numerically specified

    1.. *

    1..5,8

    0..1

    Class Modeling

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    31/62

    Class ModelingAggregation

    Aggregation is a special form of association thatindicates a part-of relationship between a

    whole and its parts

    Useful when the parts do not have independent

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    A part is subordinate to the whole

    In an aggregation, properties and operations may

    be propagated from the whole to its parts

    Class Modeling

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    32/62

    Class ModelingOMT Aggregation Notation

    Window

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    TitleBar ScrollBar Border

    Class Modeling

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    33/62

    Microcomputer

    Monitor System boxMouse Keyboard

    1+

    Class ModelingMultilevel Aggregation

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    Chassis CPU RAM Fan

    1+1+

    Class Modeling

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    34/62

    Class ModelingAbstract class 1/2

    Class that contains one or more abstractmethods

    Abstract method: Method that has only

    declaration but no implementation.

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    Classes that extend abstract class make them

    concrete by implementing those abstract

    methods

    Class Modeling

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    35/62

    Class ModelingAbstract class 2/2

    class animal{ protected: int speed;

    char color[20];

    public:

    pure virtual void init();

    float run(int distance){

    animal *p = new animal();

    animal p;

    It is impossible to instantiatean object from abstract class

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    It is possible to create a pointerto abstract class

    float time = round(((float)

    distance)/speed,2);

    cout

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    36/62

    Class Modeling

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    37/62

    C ass ode gPolymorphism - Overloading

    To assign an operator, identifierorliteral morethan one meaning, depending upon the data types

    associatedwith it at any given time during

    program execution.

    Two or more method with the same name,

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    different signature

    Example:

    void display (int iX)

    void display (float fY)

    void display (char[] chC)

    void display (char[] chC, int offset, int numchar)

    Class Modeling

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    38/62

    gPolymorphism - Overriding

    Process of defining/re-defining the methods inthe derived class

    Methods have same name/same signature

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    Class Modeling

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    39/62

    gPolymorphism Example 1/2

    class animal

    {

    protected: int speed;

    char color[20];

    public:

    virtual void init(){}

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    {

    float time = round(((float) distance)/speed,2);

    cout

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    40/62

    gPolymorphism Example 2/2

    class dog: public animal{

    public:

    void init()

    {

    speed = 40;

    class tiger: public animal{

    public:

    void init()

    {

    speed = 90;

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    strcpy(color, Black);

    }

    void show()

    {

    cout

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    41/62

    Dynamic Modeling

    Prepare scenarios Identify events between objects

    Prepare an event trace for each scenario

    Build a state diagram

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    Match events between objects to verify

    consistency

    Dynamic Modeling

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    42/62

    y gDynamic Model Diagrams

    The dynamic model tracks behavior over timedescribed in terms of change in objects or event

    sequences between objects

    Event Trace Diagrams

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    show typical dialog or usage scenarios as well as

    exceptional and/or special cases

    State Diagrams

    relates events, states, and state transitions

    a scenario is a path through the state diagram

    Dynamic Modeling

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    43/62

    Events & Scenarios

    An event is something that occurs between objects events have attributes, which are the information transferred

    from one object to another

    A scenario is a specific sequence of events representing

    a path through a systems states

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    Legitimate scenarios

    Common paths (e.g. frequently used functionality)

    Error conditions and known exceptions

    An event trace extends the scenario to clarify eventsbetween objects

    Dynamic Modeling

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    44/62

    Event classes & attributes

    Event Classesairplane departs

    (airline, flight number,

    city)

    EventsUnited Flight 23

    departs from Rome

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    mouse u on pus e

    (button, location)

    phone receiver lifted

    digit dialed (digit)

    r g mouse u on

    pushed at (29, 30)

    phone receiver lifted

    digit dialed (2)

    Dynamic Modeling

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    45/62

    An example scenario

    Scenario for a phone callcaller lifts receiver

    dial tone begins

    caller dials digit (2)

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    caller dials digit (7)

    caller dials digit (7)

    caller dials digit (6)

    specified phone rings

    etc.

    Dynamic Modeling

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    46/62

    OMT Event Trace Notation

    objects are vertical lines

    events are horizontal lines

    arrows indicate sender and receiver

    time passes from top to bottom

    Customer Pump Credit Corpselect method of payment

    select credit

    insert card

    slide card through reader

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    select grade

    select premium

    return approved

    display unit cost, total cost, gallons dispensed

    pump on

    pump gas

    update display with total cost, gallons dispensedcharge total cost to account

    Dynamic ModelingE T E l

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    47/62

    Event Trace Example

    Caller Phone line Callee

    caller lifts receiver

    dial tone begins

    dials (2)

    dial tone ends

    dials (7)

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    ringing tone phone rings

    answers phone

    phones connectedphones connected

    callee hangs up

    connection broken connection broken

    caller hangs up

    dials (6)

    Dynamic ModelingE t T S Di

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    48/62

    Event Trace ~ Sequence Diagram

    Asequence diagram

    is

    An interaction diagramthat details howoperations are carried out.

    What messages are sentand when.

    Sequence diagrams areorganized according to

    Object: Class

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    48

    Lifeline

    Operations

    Message

    Dynamic ModelingSt t & T iti

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    49/62

    States & Transitions

    A state is an interval between eventsit may have an activity that can trigger starting,

    intermediate and ending events

    defined in terms of a subset of object attributes and

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    A state transition is a change in an objects

    attributes and links

    it is the response of an object to an eventall transitions leaving a state must correspond to

    distinct events

    Dynamic ModelingState Machine Diagram

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    50/62

    State Machine Diagram

    A State Machine diagram

    shows the possible states ofthe object and the transitions

    that cause a change in state.

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    50

    Functional ModelingHierarchical DFD

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    51/62

    Hierarchical DFD

    High-level functionality iteratively refined into smaller functional

    units

    each high-level process may be expanded into a separate DFD

    top-level processes correspond to operations on complex objects, while

    lower-level processes are operations on basic objects

    Nesting depth is dependent on application

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    terminates with simple functions

    each level must be coherent

    Hierarchical DFD corresponds to the following

    context diagram shows boundaries of system

    mid-level DFDs show context decomposition

    primitive DFDs are simple functions that need not be expanded

    Functional ModelingDFD Example: Office Supply

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    52/62

    DFD Example: Office Supply

    Web Server input

    stream

    employee

    Employee DB

    validate

    employee

    name/

    passwordverification

    validate

    order

    order

    verificationaccount

    number

    AccountDB

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    response (receipt)

    order process

    order

    Product DB

    verification item

    finalize

    order

    validated

    order

    Order DB

    orderorder

    info

    Add Operations to the Object Model

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    53/62

    Add Operations to the Object Model

    From the Object Model:

    Reading/writing object attributes (e.g., get_width, get_height of

    Rectangle)

    From Events, State Actions, and Activities

    in the Dynamic Model:

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    Each event sent to an object => operation

    (e.g., Vending machine: set_balance)

    Actions/activities may be operations

    (e.g., Vending machine: do: test item and compute change)

    From Functions in the Functional Model:

    Each function in the DFD corresponds to an operation (e.g., bank

    example: subtract withdrawal from Account)

    OMT: Four Phases

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    54/62

    OMT: Four Phases

    Object-oriented analysisbuilds a real-world model

    System design

    determines overall architecture of system

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    Object design

    decides upon data structures and algorithms

    Implementation translates design into programming language

    OMT: Four phases1 System Design

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    55/62

    1. System Design

    Devises high-level strategyfor solving problem Set trade-off priorities

    Construct system architecture by organizing into

    subsystems (system structuring) Choose an approach for persistent data management (repository model)

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    ocate components to processors an tas s str ut on mo e

    Choose the implementation of control in software

    system (control modeling) Identify concurrency inherent in the problem

    Define access to global resources

    Divide problem into implementable components

    (modular decomposition)

    OMT: Four phases2 Object Design

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    56/62

    2. Object Design

    Full definition of all the classes in the system

    Implementation alternatives evaluated and chosen

    Combine three models to obtain class operations

    Design algorithms to implement operations

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    Implement control for external interactions

    Adjust class structure to increase inheritance

    Design associations Determine object representation

    Package classes and associations into implementable

    modules

    OMT: Four phases3 Detailed Design 1/2

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    57/62

    3. Detailed Design 1/2

    Detailed design is the process of completely

    specifying an architectural design such that module

    implementation can proceed (independently)

    Interface specifications

    brief description of each module

    FPT SOFTWARE TRAINING MATERIAL Internal use04e-BM/NS/HDCV/FSOFT v2/3

    attributes

    brief description and specify types

    operations

    brief description

    list of parameters and parameter types

    return type (if applicable)

    OMT: Four phases3. Detailed Design 2/2

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    58/62

    3. Detailed Design 2/2

    Algorithm and data structure specificationthe designer can give hints as to what algorithms

    or data structures might be most useful for a

    particular module

    FPT SOFTWARE TRAINING MATERIAL Internal use04e-BM/NS/HDCV/FSOFT v2/3

    ,algorithm or data structure that must be used

    in addition, constraints in the requirements may

    require one approach over another

    for instance, implementing a data structure so that it

    uses the minimum amount of memory possible vs.

    keeping everything in memory for speed

    OMT: Four phases4. Implementation 1/2

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    59/62

    4. Implementation 1/2

    Most programming languages provide verysimilar sets of features

    user-defined types

    control structures

    FPT SOFTWARE TRAINING MATERIAL Internal use04e-BM/NS/HDCV/FSOFT v2/3

    i ...t en...e se...

    while x do y

    for i = 1 to x

    etc

    etc.

    This means that, in general, operations can be

    expressed in many different languages

    OMT: Four phases4. Implementation 2/2

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    60/62

    4. Implementation 2/2

    Major differences between languages usuallyfall into these categories

    compiled vs. interpreted

    procedural vs. object-oriented

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    general purpose vs. application/domain specific

    e.g. C++ vs. FileMaker Pros scripting language

    If a design takes advantage of, or depends on,

    one or more of these features then certainprogramming languages have to be excluded

    from implementation

    OMT: Four PhasesModularity Mechanisms

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    61/62

    y

    One import feature of any programming language is

    how it can represent modules directly

    C and C++ have separate header and body files

    Java, .NET has package names and class files

    Ada has a construct called a package with a specification

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3

    and body (implementation)

    etc.

    These features are important since it makes it easier

    to map the design into code and to trace a code

    module back to its design counterpart

  • 7/31/2019 Day1_OOAD & UML.ppt [Compatibility Mode]

    62/62

    Q & A

    FPT SOFTWARE TRAINING MATERIAL Internal use 04e-BM/NS/HDCV/FSOFT v2/3