Event-driven programming
|
Event-driven programming is a computer programming paradigm. Unlike traditional programs, which follow their own control flow pattern, only sometimes changing course at branch points, the control flow of event-driven programs largely driven by external events.
Event-driven programs typically consist of a number of small programs called event handlers, which are to be called in response to external events, and a dispatcher, which calls the event handlers, often using an event queue to hold unprocessed events.
In many cases event handlers can trigger events themselves, possibly leading to an event cascade.
Event-driven programming stresses flexibility and asynchrony as virtues, and tries to be as modeless as possible. Graphical user interface programs are typically programmed in an event-driven style.
Computer operating systems are another classic example of event-driven programs on at least two levels. At the lowest level, interrupt handlers act as direct event handlers for hardware events, with the CPU hardware performing the role of the dispatcher. Operating systems also typically act as dispatchers for software processes, passing data and software interrupts to user processes that in many cases are programmed as event handlers themselves.
References
- Grant Palmer: Java Event Handling, Prentice Hall, ISBN 0-13-041802-1
- David Luckham: The Power of Events - An Introduction to Complex Event Processing in Distributed Enterprise Systems, Addison-Wesley, ISBN 0-201-72789-7
- George S. Fishman: Discrete-Event Simulation - Modeling, Programming, and Analysis, Springer, ISBN 0-387-95160-1
- Miro Samek: Practical Statecharts in C/C++: Quantum Programming for Embedded Systems, CMP Books, ISBN 1-57820-110-1
See also
- Signal programming (a similar concept)
- Flow-driven programming (contrast)
- Programming paradigms
- Reactor Pattern
- SEDA
- Quantum Leaps
- Liboop - event loop management library
- libsigc++ - Callback Framework for C++
- REBECA - Event-Based Electronic Commerce Architecture
- Event programming language
- Message Oriented Middleware
External links
- Description (http://c2.com/cgi/wiki?EventDrivenProgramming) from Portland Pattern Repository
- Tutorial "Event Driven Programming (http://www.freenetpages.co.uk/hp/alan.gauld/tutevent.htm)" by Alan Gauld
- Article "Transitioning from Structured to Event-Driven Programming (http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=504)" by Ben Watson
- Article "Rethinking Swing Threading (http://today.java.net/lpt/a/32)" by Jonathan Simon
- Article "The event driven programming style (http://www.csse.uwa.edu.au/cnet/eventdriven.html)" by Chris McDonald
- Article "Event Driven Programming using Template Specialization (http://codeproject.com/cpp/static-callbacks.asp)" by Christopher Diggins
- Article "Delegates and Event Handling in C# (http://visualbuilder.com/article/viewarticle.asp?id=1473)" by Faisal Jawaid
- Article "Concepts and Architecture of Vista - a Multiparadigm Programming Environment (http://www.swe.uni-linz.ac.at/people/schiffer/se-94-17/se-94-17.htm)" by Stefan Schiffer and Joachim Hans Fröhlich
- Chapter "Event-driven programming vs. multi-threaded programming (http://ocaml-programming.de/packages/documentation/equeue/users-guide/c494.html)" from the Equeue user's guide by Gerd Stolpmann
- Chapter "Event-Driven Programming and Agents (http://docs.eiffel.com/eiffelstudio/general/guided_tour/language/invitation-09.html)"
- LabWindows/CVI Resources (http://zone.ni.com/devzone/devzone.nsf/webcategories/FCE7EA7ECA51169C862567A9005878EA)
- Comment (http://javalobby.org/forums/thread.jspa?threadID=13874&messageID=91806918&tstart=0) by Tim Boudreau
- Citations from CiteSeer (http://citeseer.ist.psu.edu/cis?q=event+driven+programming)de:Ereignis (Programmierung)