2: Role Modeling
Focus On Object Collaboration

  • 2: Role Modeling
    Focus On Object Collaboration
    a drawing

    2.1: Four aspects of OO modeling

    a drawing

    2.1.1: Simple examples

    a drawing
    The Class is a powerful device for reuse of code The role is a powerful device for the reuse of object patterns

    2.2: Main features of role modeling

    a drawing

    2.2.1: Model inheritance: Specialization

    a drawing
    Silly example, but illustrates the point.

    2.2.2: Separation of concern:
    Three uses of synthesis

    a drawing
    Previous slide: Specialization.

    2.2.3: Composition on
    same level of abstraction

    a drawing
    EXPLAIN IN TWO STEPS Peer composition.

    E.g., total system composed of

    2.2.4: Aggregation

    a drawing
    Hierarchical decomposition (aggregation). E.g., the Controller encapsulates - Sensor for capturing and interpreting keyboard events - One or more menus for user commands - menu contains sensor for capturing mouse events

    2.2.5: Important observations:

    "Religious wars" meaningless - it's OK if it is useful, - it's better if it is more useful, Role modeling may be best in some project phases Class modeling may be best in other phases

    2.3: Role Model Advantages

    a drawing
    OOram role model: powerful object abstraction !! OOram is the common sense of objects !!

    Tutorial called Working with objects because essence of OO is objects that interact to achieve some higher purpose.

    Advantages

    2.4: Role models describe object patterns

    01-MVCDGR
    Third advantage:

    Advantages

    - Isolate a manageable problem
    - construct solution from well-defined components (frameworks)
    - No global variable + no global schema

    2.4.1: Role Model Collaboration view notation

    01-MVCDGR
    DO NOT SHOW

    2.4.2: Compare with class hierarchy
    (VisualWorks class library)

    a drawing
    !! This abstraction does not tell me how the instances cooperate to do the task !!

    2.4.3: Environment Collaboration view

    01-MVCDGR
    Our simple example is an editor

    2.4.4: Scenario view

    a drawing
    Use cases - Message Flows - Data Flows - FSMs

    Explain notation: Example message flow

    2.4.5: Role modeling
    focuses on object patterns

    a drawing
    Contrast class modeling with the OOram focus on objects and their interaction The OOram method is based on an important result from systems theory: the value of a system is greater than the sum of the values of its parts.

    2.5: Modeling distribution

    Two-tierDGR

    2.5.1: Determine distribution architecture

    a drawing

    2.6: Separation of Concern
    A TextView object plays many roles

    a drawing
    First advantage:

    2.7: Reuse through model inheritance

    01-MVCDGR
    Second advantage:

    Coordinated specialization of all roles makes it a TextEditor!

    Advantages

    2.8: Seamless bridge to implementation

    01-MVCDGR
    Lastly: Go through messages, stress SPECIFY MSG ALLOWED TO SEND + parameters

    Tutorial called Working with objects because essence of OO is objects that interact to achieve some higher purpose.

    2.8.1: Method views
    Inside object perspective

    No RM model
    For each received message, the method describes how to handle it - it is the entry in the 'rule book' EXPLAIN BASE METHOD AND OVERRIDE

    2.8.2: Mapping concepts
    from OOram to implementation

    a drawing
    IN SUMMARY: EXPLAIN ALL TEXT

    2.8.3: Program code
    Class perspective

    a drawing
    READ BOTH CODES

    2.8.4: Semantic model - Object System

    a drawing