Role Model Designs and Implementations with AspectOriented Programming - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

Role Model Designs and Implementations with AspectOriented Programming

Description:

Interface Bloat. The interface for all the Role objects must be contained in AgentInterface. ... for Agent is not bloated with methods for every possible ... – PowerPoint PPT presentation

Number of Views:60
Avg rating:3.0/5.0
Slides: 17
Provided by: john378
Category:

less

Transcript and Presenter's Notes

Title: Role Model Designs and Implementations with AspectOriented Programming


1
Role Model Designs and Implementations with
Aspect-Oriented Programming
  • Elizabeth A. Kendall
  • Poster by
  • John Volk

2
Paper Structure
  • Describe the problem.
  • while(solution insufficent)
  • Describe a solution X to the problem.
  • Decide whether solution X is sufficient.
  • Describe benefits/drawbacks to solution X.

3
Bureaucracy Design Pattern (Problem)
  • Describes interactions between various agents
    acting in different roles.
  • Special case of a more general Pattern referred
    to as a Role Model.
  • Other examples
  • Supply Chain
  • Negotiate for Services
  • Contract Net
  • Iterated Contract Net
  • Auction

4
Bureaucracy Structure
  • Five Different Roles
  • Director
  • Manages whole organization.
  • Manager
  • Report to the Director, and supervise their
    Subordinates.
  • Subordinate
  • Take orders from their Manager.
  • Clerk
  • Perform actual work requested by a Client.
  • Client
  • Request that work be done by the organization.
  • Example
  • Most obvious real-world example of this type of
    system would be a client-server architecture in
    which Clients make requests, and the Bureaucracy
    funnels the request to the Clerk most capable of
    performing the required task.

5
Bureaucracy Structure
6
Role Properties
  • Abstractivity
  • Roles can be organized into hierarchies
  • Aggregation/Composition
  • Roles can be composed of other roles.
  • Dependency
  • A role cannot exist without the object playing
    the role.
  • Dynamicity
  • Roles can be added/removed from an object during
    its lifetime.
  • Identity
  • The role and the object playing the role have the
    same identity.
  • Inheritance
  • A role for a class is also a role for its
    subclass.
  • Locality
  • A role only has meaning inside of a role model.
  • Multiplicity
  • An object can play multiple roles at the same
    time.
  • Visibility
  • The visibility of an object can be restricted to
    the interface of the role it is playing.

7
Traditional OO Solution
  • Role Object Pattern
  • An individual class is created for each role.
  • Role objects are organized in a hierarchy.
  • Core objects (agents) contain a collection of
    role objects.
  • Role objects can be added/removed from the core
    objects at runtime.

8
Role Object Pattern
9
Role Object Pattern Problems
  • Object Schizophrenia
  • This solution violates the Identity property,
    because the agents behavior is distributed over
    the Core object and its Roles. The agent and
    its roles should be in the same object.
  • Interface Bloat
  • The interface for all the Role objects must be
    contained in AgentInterface.

10
Aspect-Oriented Solution
  • Core behavior that is similar across all agents
    is placed in an Agent class.
  • Roles are placed in various aspects that are
    organized into a hierarchy.
  • Aspects have two main parts
  • The introduce weave is the part of an aspect that
    adds additional methods to an objects static
    structure.
  • The advise weave is the part of an aspect that
    modifies the dynamic (run-time) execution of an
    objects methods.

11
Aspect Structure (Static and Dynamic)
12
Role Hierarchy
13
Clerk Code Example
14
Client Code Example
15
Aspect-Oriented Solution Benefits
  • Object Schizophrenia
  • Maintains the Identity role property, because
    most role-specific code resides in the object
    itself as a result of the introduce and advise
    weaves.
  • Interface Maintenance
  • The interface for Agent is not bloated with
    methods for every possible role.

16
Questions
  • What are some other potential uses of the
    Bureaucracy pattern besides a client-server
    architecture?
  • What patterns other than the Role Object pattern
    might be used in creating an OO design for a
    Bureacracy?
  • Theres no Director role in the role hierarchy
    described for the aspect-oriented solution. How
    might it be possible to create a Director agent
    using the available roles?
Write a Comment
User Comments (0)
About PowerShow.com