BERNADETTE BRZEZINA - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

BERNADETTE BRZEZINA

Description:

Telephone switchboard systems. Asset tracking systems. Conclusion ... dofactory.com/Patterns/PatternObserver.aspx. http://www.ibm.com/developerworks/webservices ... – PowerPoint PPT presentation

Number of Views:100
Avg rating:3.0/5.0
Slides: 19
Provided by: Bern222
Category:

less

Transcript and Presenter's Notes

Title: BERNADETTE BRZEZINA


1
Observer and Reactor A Real-Time Comparison
  • GROUP 2
  • BERNADETTE BRZEZINA
  • PATRICK GAVIGAN
  • NADINE HILL
  • WILLIAM KNISELY
  • SYSC 4805/4806
  • WINTER 2008

2
Outline
  • Refresher on Design Patterns
  • Observer
  • Description
  • Design Considerations
  • Real-Time Applications
  • Reactor
  • Description
  • Design Considerations
  • Real-Time Applications
  • Compare and Contrast

3
What is a Design Pattern?
  • Facilitates reuse of successful designs, not code
    reuse
  • Common solutions to similar problems
  • Standard strategies
  • Interface reuse

4
Observer Description
  • Define a one to many dependency between objects
    so that when one object changes state, all its
    dependencies are notified and updated
    automatically
  • Allow multiple clients to effectively share a
    server and autonomously be updated

5
Observer Class Diagram
6
Observer Sequence Diagram
7
Observer Design Considerations
  • Advantages
  • Decouples observer from subject
  • Reuse observers and subjects independently
  • Easily add or take away observer

8
Observer Design Considerations
  • Disadvantages
  • Decreased performance when there are many
    observers
  • Possible memory leaks
  • Hidden dependencies
  • Unexpected updates

9
Observer Real-Time Applications
  • Graphical user interfaces.
  • Can be used for data acquired through sensors
  • Can add heart-beat functionality

10
Reactor - Description
  • Handles events from multiple sources/clients a
    many to one relationship
  • Dispatches event handlers automatically in
    response to external events
  • Allow multiple clients to effectively connect to
    a server and independently access its services

11
Reactor UML Class Diagram
12
Reactor UML Sequence Diagram
13
Reactor Design Considerations
  • Advantages
  • Allows for the combination of multiple events,
    without introducing additional threads avoiding
    expensive context switching
  • Simplifies event-driven applications by
    decoupling event demultiplexing and handler
    dispatching from event application services
  • Easily add or take away event handlers (compile
    time)

14
Reactor Design Considerations
  • Disadvantages
  • Performance limited by the number and computation
    time of handlers
  • Scalability limited by the demultiplexing and
    synchronous calling of handlers
  • Can be very hard to debug due to the
    non-procedural design

15
Reactor Real-Time Applications
  • Event logging servers
  • Graphics systems
  • Telephone switchboard systems
  • Asset tracking systems

16
Conclusion
  • Observer and Reactor are design patterns often
    used in real-time applications
  • Observer
  • Can be used for client-server interaction
  • Notifies clients of updates
  • One to many
  • Reactor
  • Can be used for client-server interaction
  • Responds to external events (clients)
  • Many to one

17
References
  • Schmidt, Douglas C., Using Design Patterns to
    Develop Reusable Object-Oriented Communication
    Software, COMMUNICATIONS OF THE ACM October
    1995/Vol. 38, No. 10
  • Porter, A., Design Patterns, March 21, 2002
  • Shirazi, J., Java Performance Tuning, np
    OReilly, nd
  • http//pocoproject.org/poco/docs/Poco.Net.SocketRe
    actor.html
  • http//citeseer.ist.psu.edu/cache/papers/cs/13106/
    httpzSzzSzwww.esconline.comzSzdb_areazSz98springz
    Sz225.pdf/real-time-design-patterns.pdf
  • http//www.cs.umd.edu/class/spring2002/cmsc433-020
    1/Lectures/designPatterns.pdf
  • http//www.dofactory.com/Patterns/PatternObserver.
    aspx
  • http//www.ibm.com/developerworks/webservices/libr
    ary/ws-dbarch/

18
Thank You
  • Questions?
Write a Comment
User Comments (0)
About PowerShow.com