Home | | Software Architectures | Event Based Styles

Chapter: Software Architectures : Architectural styles

Event Based Styles

Instead of invoking a procedure directly, a component can announce one or more events (such as arrival of data or execution of an operation)

Event Based Styles

Objective

 

•      Instead of invoking a procedure directly, a component can announce one or more events (such as arrival of data or execution of an operation)

 

•               ON <EVENT> IF <CONDITION> THEN <ACTION>

 

•               On arrive D  if D < a or D ≥ b then print ( “out of bounds”)

 

•                  Such procedures are also called triggers, actors or eventcondition-action (ECA) rules

 

•               An advantage of event-based invocation is that it encourages reuse; a component can be introduced in a system simply by registering it for the events of that system

 

• A drawback is that sometimes event-based systems become quite unpredictable and hard to control.


 

•               A component may:

 

•               Announce events

 

•               Register a callback for events of other components

 

•               Connectors are the bindings between event announcements and routine calls (callbacks)

 

•               Publishers of events do not know which components (subscribers) will be affected by those events

 

•               Components cannot make assumptions about ordering of processing, or what processing will occur as a result of their events

 

•               Examples

 

•                   Programming environment tool integration

 

•               User interfaces (Model-View-Controller)

 

•               Syntax-directed editors to support incremental semantic checking

 

Event-Based Style: example

 

 

 

•               Integrating tools in a shared environment

 

•               Editor announces it has finished editing a module Compiler registers for such announcements and automatically re-compiles module

 

Editor shows syntax errors reported by compiler

 

Debugger announces it has reached a breakpoint Editor registers for such announcements and automatically scrolls to relevant source line

 

Advantages and Disadvantages


•               Strengths:

 

Strong support for reuse: plug in new component by registering it for events

 

 Maintenance: add and replace components with minimum effect on other components in the system

 

 

•  Weaknesses:

 

Loss of control:

 

What components will respond to an event?

 

In which order will components be invoked?

 

Are invoked components finished?

Correctness hard to ensure: depends on context and order of invocation


Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
Software Architectures : Architectural styles : Event Based Styles |


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2027 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.