Event-based, Implicit Invocation: Ajay Mansata

advertisement

Event Based Implicit

Invocation

By

Ajay Mansata

INTRODUCTION

An Architectural style defines a family of systems.

It defines the vocabulary of components and connectors that can be used in instance of a particular style.

For example if we are using a pipeline

Architecture model then there are certain rules as to how data will flow between various components making up the system. Now this will be different in a Peer to Peer Architecture.

Current Operation

In Traditional Systems where Component Interfaces interact with each other, the interaction is through invocation procedures and functions when required.

Now usually a Component calls procedures and functions of other components to perform certain actions depending on certain events occurring.

Consider an example where a customer authenticates himself to the bank. Now After the customer logs in , the verification system verifies the user and then calls procedures such as account status, balance etc.

Main Idea

The Main Idea behind implicit invocation is that instead of components invoking procedures of other components , a component announces one or more events.

The other components if they want to act on a particular event they can register the appropriate methods with that event.

When that particular event is announced the system invokes all the procedures registered with that event.

Now here many different procedures can be invoked thus giving a parallel look to it.

Example

The Example presented in the documents is that of a debugger. When we stop a debugger at a break point the debugger announces an event.

Corresponding to this event various procedures are called which might record the value of a specified variable or scroll an editor to an appropriate line.

Now here all the debugger does is announce an event. It is not concerned as to which procedures might be invoked and in what order the procedures may be executed if there are more than one procedures called

Diagrammatic View

Overview

Observer

Opfor Event1(.)

Opfor Event2(.)

1 n

Event Stub

Forward(..)

Operation

Observer n

Overall Implicit

Invocation

Subject

StateChange 1

Statechange 2

……………

1

1 n

State Change

Announce(..)

Register()

Deregister()

Example continued

Subject: Defines an abstract state

State Change:

- Represents a possible state change

- Offers operation for the subject to trigger event notification

- Offers operations to register and unregister observers via event stub Object.

Observer : Provides event stub with an operation reference to be called incase of invocation.

Continued

Event Stub : Knows which operation of its owner an observer) is to be called in case of invocation.

Collaborations:

If a subject changes its state , it triggers the corresponding state change object.

A state change object distributes the notification to all its event stubs.

An Event Stub forwards a notification to its owner (an observer).

Components and Connectors

Components in an implicit invocation style are modules whose interface provide both a collection of procedure and a set of events.

Procedures may be called normally and in addition some procedures may be registered with a particular event.

The Connectors include traditional procedure calls as well as binding between event announcement and procedure calls.

Benefits

Strong support for Reuse.

A component can be introduced into a system simply by registering it for events of that system.

Another benefit is that it eases out system evolution.

Components may be replaced by other components without affecting the interfaces of other components in the system.

In contrary to this is explicit based system whenever the identity of a component that provides some system function is changed, all modules that import that module must also be changed.

Disadvantages

Component does not have control over computations performed in the system.

Component has no idea what other components will respond to against an event.

In what order operations take place is also not known to the component and when is the operation done with. To overcome this explicit invocation is also included in systems.

Global Performance and Resource Management become a serious issue since all components share a common repository.

Example

One example could be the java awt package. In these when we design buttons we associate event handlers for that button. Whenever that button is clicked all the event handlers are executed.

References

An Introduction to Software Architecture

By Garlan & Shaw.

http://www.riehle.org/computer-scienceresearch/1996/tapos-1996-event.pdf

Thank you

Thank you very much

Download