How To Implement An Event Driven Programming Model

How To Implement An Event Driven Programming Model - How To...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
How To Implement An Event Driven Programming Model. .. In your introductory programming courses and our labs thus far, you mostly used the basic program structures of sequential, conditional, and iterative code associated with a procedural program. If you look back at those programs, you see that they were always in control of when the input occurred - your code looked for input at specific places in your program and waited until the input was ready. Unfortunately, while your program was looking for a particular kind of input, it wasn t doing any other work. Although this approach to programming is adequate in many situations, it doesn t work very well when there are many possible sources of input with unpredictable arrival times and the requirement that all inputs must be accounted for. Consider a typical DVD player which has a number of buttons and sensors. Commands can be received at any time from console buttons, a wireless remote, and/or pending events such as the DVD has loaded or the laser has arrived at a selected chapter. The program for the DVD microcontroller must be able to respond to any of these inputs, at any time, and in any sequence. This problem is also very common in modern desktop/laptop computers. Think about using a word processor. The program must always be ready to accept and act upon your key presses, mouse clicks, and other system events. Typing usually inserts characters into your document. But, depending on the current mode of the word processor, those characters may be entered into a dialog and not your document. You can also click with the mouse at any place on the screen which may move the insertion point, drop down a menu,
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 02/08/2012.

Page1 / 4

How To Implement An Event Driven Programming Model - How To...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online