Uses and Advantages of Event Driven Programming

A description of the uses and advantages of event driven programming.

There are four main typical uses and advantages of event driven programs, these are as follows –

  • Flexibility
  • Suitability for graphical interfaces
  • Simplicity of Programming
  • Ease of development

In the following article, I am going to describe these things.

 

                Flexibility

Event driven programming is one of the most flexible programming language types.  It allows the programmer to visually design the form to their needs and program the objects on the form with a huge range of sevents that can do different things when run.  It gives the programmer more control over what they want the program to do when a user does something. 

 

Suitability for graphical interfaces

Because of the graphical way a programmer creates their program in an event driven programming language it is much suited to graphical user interfaces.  When programming with an event driven language, the programmer can select different controls such as a command button and place it on the form where necessary.  Then with very little code, the button can perform a process when the chosen event is noticed by the program.  Event driven programming allows the user to use the program without following any certain routine, they have complete control over what actions they want the program to carry out.

Simplicity of programming

The visual aspect of event driven programming simplifies even the most complex programming tasks.  Because the programmer can visually create their program by placing different objects on the form, it saves a lot of time and effort.  Event driven programming is great for beginner programmers as it is easy to use.  Visual Basic works by letting the programmer place controls anywhere on the form, when the control is selected, the programmer can change properties of the control easily using the properties tab.  This allows the programmer to change the look of the control and also the way it works. 

Ease of development

Developing a program in an event driven language is easy because of the way the programmer only has to deal with event of one control at a time.  This is because all of the controls on a form are programmed independently, even though they will sometimes work together.                

 

Typical Uses of EDP

Event driven programming is used extensively in the day to day world.  There are many machines that run by an event driven system. 

Firstly, a cash point would be a good example of event driven programming in everyday life.  The machine is constantly searching for a debit or credit card to be inserted to the machine by using an event loop.  When a customer puts their card into the machine, the trigger function begins, telling the program to run the bit of code asking the customer for their PIN number.  When the PIN has entered, it is checked by the machine to the data on the card and then the customer is displayed with several options.  If they are withdrawing cash, they will press the “withdraw” button and then select a value they want to take out.  The machine then starts the code that counts up the money to be dispensed.  Once the money has been withdrawn and any receipts taken, the machine ejects the customer’s card. 

Many supermarkets now have self service checkouts where customers can purchase their goods quickly themselves.  The machines work by using a touch screen that the customer can select options on and a barcode scanner that the customer uses to scan their products.  When the customer starts their order, the machine begins to create a list of all the items they scan.  When an item is scanned, the machine searches the database of barcodes to find the details of the product.  Once all products have been scanned and totalled, the customer must press the “Pay Now” button.  When the “Pay Now” button had been pressed, the machine tells the customer how much the totalled items will cost and offers several payment types that are accepted.  The customer chooses the payment type they want to pay with and then the machine accepts their cash or card.  This type of machine is event driven because there are things the user must do to make the machine work.  Firstly the user must start the transaction, which prepares the machine for taking the order, and then the user must scan the items they want to purchase.  Then the user must choose a payment method by selecting it on the touch screen.  And then insert the cash or card.

 

Many shops now contain self service photo printers for customers to personally select and edit photos they would like to print.  Certain machines work like this…

The customer taps the screen to begin using it.  There is an event loop constantly looping looking for the event (someone touching screen) to happen.

The machine asks for the customer’s memory card or CD.  The photos are then loaded and the customer selects the images they want to print.  When they have chosen all the images they want to print, and confirm it, the machine begins another piece of code to start the printer of the machine.  When the printer starts, the machine also displays the cost of the photos and where to pay.

 

A vending machine is a simple machine that could be programmed using event driven programming.  It works by waiting for money to be inserted to the machine, only when there is money present will the machine work.  Once the money has been inserted, it allows the user to select a drink or item of food they want to purchase.  When a button is pressed to dispense a drink, this starts an event handler witch dispenses the corresponding item.

2 Responses

Duncan
09.11.17

It allows the programmer to visually design the form to their needs and program the objects on the form with a huge range of sevents that can do different things when run.

I presume you mean events and not sevents on the final line as it doesn\\\’t quite make sense

Pwning n00bs 24/7
09.11.17

Oh Duncan, that is just one of many, many mistakes made in this article.

Leave Your Response