Hottest Trending Photo Event Technology- Interactive Digital Graffiti Wall

Event Driven Programming?

Question by That Desi Gurl: Event Driven Programming?
I have to answer this question:

Demonstrate the use of event driven tools and techniques.

How would I go about doing this? What are the common tools and techniques of event driven programming?

Best answer:

Answer by angel.white
Event driven programming is programming lots of different responses to various events that might occur. Typically you will see this style of programming in regards to user interfaces, because you don’t know what the user will do, so you set it to respond to whatever event they do. For example, in Java, you might program an event for if they press a button.

You also see event driven programming when it comes to error handling. An error is considered an event, and must be handled (or ignored) so that the program doesn’t shut down.

In this case, the event is the error. Notice they are both sort of unpredictable, that break the normal flow of the program.

I don’t know what the tools are called, with error handling in Java it’s a “catch” block, where you “catch” the error. In ruby that would be a rescue. For events in Swing (one of Java’s GUI builders), you have what are called “listeners” that “listen” for events that they are assigned to. In Ruby on Rails, an HTTP request can be considered an event, and based on how it came in, and what the URL is, it will rout the responsibility to some piece of code designed to handle that event.

The interesting (irritating) thing about event driven programming is that there isn’t an obvious relationship between pieces of code. Typically, whatever code calls the event occurs behind the scenes, and simply directs the program to the code you wrote to handle it. This is difficult to get used to, because it means your program is not linear, you can’t trace it from one place to the next, it won’t be obvious how some piece of code gets invoked, it will just magically happen.

Anyway, hope that is helpful.

Give your answer to this question below!

One Response

  1. RDS

    When ever u do anything in computer, there is an event happening under which your work in performing like clicking, double clicking, mouse move, keypress, keyup, keydown, loading, unloading etc. So when we do programming considering these events, it’s called event driven programing.
    U can use Visual basic as an Event Driven Programming tool.

    Best of Luck

    April 29, 2014 at 3:52 am

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by Yahoo! Answers

Local Events, Concerts, Tickets
Events by Eventful