I want to learn more about event driven programming. Especially where and why I would consider using events. What resources/books should I consider reading to this end? (note: I'm indifferent to language. )
closed as off-topic by user22815, gnat, user40980, ratchet freak, durron597 Apr 17 '15 at 13:01
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Community, Community, ratchet freak, durron597
Other than Jalayn's excellent answer I'd like to add:
Consider learning the Observer pattern
It is a Design Pattern used to implement event handling. If your programming language doesn't have first class support on delegates and events (see in Java how it solves with event handling in AWT and Swing) then you'll be implementing it using this pattern instead.
Note that Java has an
Observable available in it's class library, but it is surprisingly simple to implement these yourself. In C# there are the
IObservable (that has some LINQ capabilities through Rx), but you can use delegates and events as well for the same purpose.
If you're indifferent to languages, you may try it in C# (Visual Studio Express C# is free). C# has specific
delegate keywords for event-drive programming, and it is quite easy to grasp the idea. It starts with how event listening works, and ends with how to write your own events. There is also an interesting, but a bit further advanced article, on how to implement event-based asynchronous patterns here.
Now, there is an MSDN tutorial to start you up with the basic idea.
If you want to try it in Java, you may, while programming a Swing application. There is also an Oracle tutorial on that subject, more specifically the intro. Edit: check out @Spoike's answer about the Observable pattern.
It is more specific to how JQuery's handles events, but you may find Benson Wong's tutorial helpful. Also, you just need to download JQuery, and you're ready to try.
Consider this an addendum to the real answers. But you could look into hardware interrupts on the hardware platform of your choice. Say, on an Arduino or some such micro-controller.
These are what drive event-driven programming. Higher level programmers don't usually interface with them directly, but it's good to know about the underlying hardware.
Though i wrote in a different context - here is a best compilation of resources to your query: https://softwareengineering.stackexchange.com/questions/82462/what-is-the-architecture-model-of-an-android-application/131352#131352
Basically, learn various patterns from POSA and related literature from the same author.
Another good resource is here.
Also, if you are in C, consider using libevent. It shows how good scalability is achievable using such constructs.