Suitability of event driven programs – D1 Essay
Suitability of event driven programs – D1
The washing machine sits idle waiting for a command from the user via the buttons (event triggers). It then identifies what button was pressed and then executes the code associated with that trigger. As the dial moves, it will hit the trigger point which will cause the next action however; the user can stop the process immediately with a certain button (trigger). A washing machine cannot assume because the code means that it will always perform the same things.
Event driven programming is good as it sits there idle until the event trigger occurs and it is quick to respond to this. Event driven programming is also very simple when it comes to coding as it shows the possible commands for that part of the code, it also allows the user to put a code in without typing which is a lot faster and reduces error. You have to put your ID cards over the detectors (event trigger) and they then execute the code for the barriers to open or closed.
If the ID card is accepted, the code will be run for the light to change green and for the barrier to open but if the ID card isn’t accepted, then the code will be run for the red light to show and the barriers will not open. An event driven programme here is not really suitable here as it can take a long time for the card to be checked and this can cause long queues of people. Also, people go in and out from the same direction so this can also be a problem as someone may wanting to go out and someone may wanting to go in.