Explore Patterns in Context-Aware Applications --Using Reactor Pattern to Develop In/Out Board Fall 2002 Yu Du
Outline Motivation Pattern definition In / Out Board using Reactor Pattern – Requirements – Design – Reactor Pattern – Screen shots Conclusions
Motivation Context-aware applications is complex. Patterns are a recent software engineering problem-solving discipline. An attempt to describe good designs, and capture experience for reuse. “The long term goal is to develop handbooks for software engineers.” Explore patterns in context-aware applications development.
What is pattern A pattern is a reusable solution to a recurring problem. Context Program structure Participants Consequences: both positive and negative Examples!
Pattern example class Singleton { public: static Singleton* Instance(); // gives back a real object! proof(void); // proof that the object was made protected: Singleton(); // constructor private: static Singleton* _singleton; };
In/Out Board Displays the in/out status of users Displays the day and time when the users last entered/left the room Web-based application User-defined services will be triggered upon user’s entering / leaving. – Turn on / off the lights – Pull out the seat – Turn on and log in the user’s computer – Coffee will be served
Architecture Design Client (Web Browser) User Info DB (MS Access) In/Out Event Simulator HTTP RMI Main Server (Java programs) Web Server (Tomcat, JSP) JDBC RMI
Main Server Design -- Reactor Pattern For demultiplexing and dispatching handles for synchronous events. Also known as dispatcher, notifier. Used in – CORBA ORBs – InterViews – Ericsson EOS Call Center Management System – ACE Framework
Main Server Design -- Reactor Pattern
Reactor Pattern Handles: identify resources Synchronous Event Demultiplexer: blocks awaiting events to occur on a set of Handles. Initiation Dispatcher: an interface for registering, removing, and dispatching Event Handlers. Event Handler: specifies hook methods Concrete Event Handler: implements the hook method, as well as the methods to process these events
Reactor Pattern – General Collaborations
Pro’s & Con’s Separation of concerns Improve modularity, reusability Improve application portability Provides coarse-grained concurrency control Non-preemptive Hard to debug
User Interface
User Interface -- Event Simulator
Conclusions Patterns are useful for developing and documenting software. Patterns repositories have been set up for – Distributed systems – Database systems – Fault tolerant systems… More exploration on context-aware applications
Questions?