Event Based Implicit Invocation By Ajay Mansata. INTRODUCTION An Architectural style defines a...

14
Event Based Implicit Event Based Implicit Invocation Invocation By By Ajay Mansata Ajay Mansata

Transcript of Event Based Implicit Invocation By Ajay Mansata. INTRODUCTION An Architectural style defines a...

Page 1: Event Based Implicit Invocation By Ajay Mansata. INTRODUCTION An Architectural style defines a family of systems. An Architectural style defines a family.

Event Based Implicit Event Based Implicit InvocationInvocation

By By

Ajay MansataAjay Mansata

Page 2: Event Based Implicit Invocation By Ajay Mansata. INTRODUCTION An Architectural style defines a family of systems. An Architectural style defines a family.

INTRODUCTIONINTRODUCTION

An Architectural style defines a family of An Architectural style defines a family of systems.systems.

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

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

Page 3: Event Based Implicit Invocation By Ajay Mansata. INTRODUCTION An Architectural style defines a family of systems. An Architectural style defines a family.

Current OperationCurrent Operation

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

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

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

Page 4: Event Based Implicit Invocation By Ajay Mansata. INTRODUCTION An Architectural style defines a family of systems. An Architectural style defines a family.

Main IdeaMain Idea The Main Idea behind implicit invocation is The Main Idea behind implicit invocation is

that instead of components invoking that instead of components invoking procedures of other components , a procedures of other components , a component announces one or more events.component announces one or more events.

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

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

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

Page 5: Event Based Implicit Invocation By Ajay Mansata. INTRODUCTION An Architectural style defines a family of systems. An Architectural style defines a family.

ExampleExample The Example presented in the documents is The Example presented in the documents is

that of a debugger. When we stop a that of a debugger. When we stop a debugger at a break point the debugger debugger at a break point the debugger announces an event. Corresponding to this announces an event. Corresponding to this event various procedures are called which event various procedures are called which might record the value of a specified might record the value of a specified variable or scroll an editor to an appropriate variable or scroll an editor to an appropriate line.line.

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

Page 6: Event Based Implicit Invocation By Ajay Mansata. INTRODUCTION An Architectural style defines a family of systems. An Architectural style defines a family.

Diagrammatic ViewDiagrammatic View

OverviewOverview Subject

StateChange 1Statechange 2……………

Observer

Opfor Event1(.)Opfor Event2(.)

State ChangeAnnounce(..)Register()Deregister()

Event StubForward(..)

OperationObserver

1

n

1

n1n

Overall ImplicitInvocation

Page 7: Event Based Implicit Invocation By Ajay Mansata. INTRODUCTION An Architectural style defines a family of systems. An Architectural style defines a family.

Example continuedExample continued

SubjectSubject: Defines an abstract state: Defines an abstract state State ChangeState Change:: - Represents a possible state change- Represents a possible state change - Offers operation for the subject to trigger - Offers operation for the subject to trigger

event notificationevent notification - Offers operations to register and - Offers operations to register and

unregister observers via event stub Object.unregister observers via event stub Object. ObserverObserver : Provides event stub with an : Provides event stub with an

operation reference to be called incase of operation reference to be called incase of invocation.invocation.

Page 8: Event Based Implicit Invocation By Ajay Mansata. INTRODUCTION An Architectural style defines a family of systems. An Architectural style defines a family.

ContinuedContinued

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

CollaborationsCollaborations:: If a subject changes its state , it triggers If a subject changes its state , it triggers

the corresponding state change object.the corresponding state change object. A state change object distributes the A state change object distributes the

notification to all its event stubs.notification to all its event stubs. An Event Stub forwards a notification to its An Event Stub forwards a notification to its

owner (an observer).owner (an observer).

Page 9: Event Based Implicit Invocation By Ajay Mansata. INTRODUCTION An Architectural style defines a family of systems. An Architectural style defines a family.

Components and ConnectorsComponents and Connectors

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

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

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

Page 10: Event Based Implicit Invocation By Ajay Mansata. INTRODUCTION An Architectural style defines a family of systems. An Architectural style defines a family.

BenefitsBenefits Strong support for Reuse.Strong support for Reuse. A component can be introduced into a system A component can be introduced into a system

simply by registering it for events of that system.simply by registering it for events of that system. Another benefit is that it eases out system Another benefit is that it eases out system

evolution.evolution. Components may be replaced by other Components may be replaced by other

components without affecting the interfaces of components without affecting the interfaces of other components in the system.other components in the system.

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

Page 11: Event Based Implicit Invocation By Ajay Mansata. INTRODUCTION An Architectural style defines a family of systems. An Architectural style defines a family.

DisadvantagesDisadvantages Component does not have control over Component does not have control over

computations performed in the system.computations performed in the system. Component has no idea what other Component has no idea what other

components will respond to against an event.components will respond to against an event. In what order operations take place is also not In what order operations take place is also not

known to the component and when is the known to the component and when is the operation done with. To overcome this explicit operation done with. To overcome this explicit invocation is also included in systems.invocation is also included in systems.

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

Page 12: Event Based Implicit Invocation By Ajay Mansata. INTRODUCTION An Architectural style defines a family of systems. An Architectural style defines a family.

ExampleExample

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

Page 13: Event Based Implicit Invocation By Ajay Mansata. INTRODUCTION An Architectural style defines a family of systems. An Architectural style defines a family.

ReferencesReferences

An Introduction to Software An Introduction to Software Architecture By Garlan & Shaw.Architecture By Garlan & Shaw.

http://www.riehle.org/computer-http://www.riehle.org/computer-science-research/1996/tapos-1996-science-research/1996/tapos-1996-event.pdfevent.pdf

Page 14: Event Based Implicit Invocation By Ajay Mansata. INTRODUCTION An Architectural style defines a family of systems. An Architectural style defines a family.

Thank youThank you

Thank you very muchThank you very much