Event-driven programming refers to the programming technique where the flow of the program is driven by recognition and handling of events such as mouse clicks, key presses, etc.

learn more… | top users | synonyms

1
vote
1answer
149 views

Good pattern(s) for pointing to mutable state

I asked this question once here, but believe the question was unclear. However I'm having a hard time extracting the general problem from my specific case. UPDATE: I've answered my own question ...
6
votes
1answer
577 views

Communication between nested directives

There seem to be quite a few ways of communicating between directives. Say you have nested directives, where the inner directives must communicate something to the outer (e.g. it's been chosen by the ...
0
votes
3answers
58 views

One Event Sent to Multiple Listeners, Want to Log Notification Once

I have a system in place where a Cache is made up of many Cache Nodes. When one is added, a CacheNodeAdded event is raised by the Cache. The Cache has a redundant set of Monitors listening for ...
1
vote
0answers
69 views

State Pattern Code for embedded device - Dependency Injection of Device Objects in Context and State Classes

I'm wrestling with some code and I think I've finally gotten some state pattern code working with my events. I've got a simplified system that will work like this: This is my first go with State ...
0
votes
3answers
117 views

When/Where to create/assign event handlers to its elements

Lets say I have the following code // JS $(function(){ $('[data-mc=logout]').click(function(){ if (!confirm(myconfig.msg['asklogout'])) { return false; ...
8
votes
5answers
443 views

Is event chaining considered good practice?

From time to time I've encountered scenarios where several complex conditions need to be met prior to triggering an event. Furthermore, most listeners also run additional checks to determine the ...
0
votes
0answers
151 views

Managing data within the Scalable JavaScript Application Architecture (Zakas)

I've been reading a lot about scalable JavaScript applications and found the architecture in this presentation by Nicholas Zakas quite amazing. However I had a few questions concerning data/models ...
3
votes
1answer
169 views

Should Libraries Use Events or a Set Action

I'm building a small reusable library for two systems our company manages. Something that I've been caught up on is whether I should expose a set of properties of type Action<T> for events such ...
0
votes
1answer
139 views

How does jQuery's mechanism of event handlers work

I'm in the need of widen my perspective on the framework libraries, to be able to make well aware choices of if/which/when to add a framework to a website. One thing that got my attention was event ...
4
votes
2answers
207 views

How is the publish-subscribe pattern different from gotos?

My understanding is that Goto statements are generally frowned up. But the publish-subscribe pattern seems to be conceptually similar in that when a piece of code publishes a message, it performs a ...
1
vote
1answer
66 views

Global vs Individual object event handlers

Lately I've been studying a lot of javascript samples, both with/without libraries, jQuery to mention one. As an old JavaScript developer, I learned early to make use of unobtrusive javascript where ...
1
vote
2answers
214 views

In an event-driven environment, how should a “cancel” function abort all further events?

In my iOS app, things are mostly driven by events. The user presses a button The app listens for an external device to be connected to the iOS device Once the device is detected (is connected), an ...
0
votes
1answer
207 views

Event Driven Programming?

I have been looking into event driven programming in C and the language doesn't seem to have support for it. This has led me to wonder about the nature of event driven programming. Is it correct to ...
0
votes
1answer
97 views

sqlite trigger or application event?

I've have two event queues(table mapped queues) based on two different states of same data stored in two different tables. The events are generated on create/update/delete on both the tables. ...
3
votes
2answers
495 views

Thread safe GUI programming

I have been programming Java with swing for a couple of years now, and always accepted that GUI interactions had to happen on the Event Dispatch Thread. I recently started to use GTK+ for C ...
2
votes
2answers
104 views

Distribution of Event Listeners in a Distributed Service Oriented Architecture

I have a service architecture composed of services that service common areas of the application. Examples of services would be: AccountService (manages client accounts in the system) BillingService ...
2
votes
3answers
271 views

Difference between event loop and system calls/interrupts

When you create programs (like a socket server) that are designed to run on an operating system, such as Ubuntu, frameworks like Qt for C++ use something called a main event loop: app = new ...
19
votes
6answers
1k views

Is an event loop just a for/while loop with optimized polling?

I'm trying to understand what an event loop is. Often the explanation is that in the event loop, you do something until you're notified that an event occurred. You than handle the event and continue ...
0
votes
0answers
24 views

Listening For and Raising Events in the BLL

I'm working on a WinForms .Net Recording App and I have a RecordingMgr in my BLL to listen for new events captured by another class. I want to display the events in my UI and I'm stuck as to what's ...
3
votes
2answers
82 views

Attaching Events to Document Better Than Attaching Them to Elements?

While bouncing around StackOverflow, I've noticed a number of people attaching events (notably click events) to the document as opposed to the elements themselves. Example: Given this: <button ...
1
vote
1answer
151 views

How to cross-reference many character encodings with ASCII OR UTFx?

I'm working with a binary structure, the goal of which is to index the significance of specific bits for any character encoding so that we may trigger events while doing specific checks against the ...
0
votes
3answers
151 views

Is it okay to call functions when event occurs, or after that?

So I was not sure how to structure this title, feel free to edit it. My question is: When I have a Game Loop, I have 3 main blocks. Handle Events, Update game state, and draw. Let's say for example I ...
0
votes
1answer
129 views

How QT Framework handles Events Coming from OS?

When we call QApplication::exec() at the end of our main() function, the application enters Qt's event loop. Conceptually, the event loop looks like this: while (!exit_was_called) { while ...
-5
votes
5answers
596 views

Can PHP handle mouse events? [closed]

I'm a newbie in php and i want to know if php can handle mouse events such as upon mouseCicked, mouseDoubleClicked, mouseMoved, mouseHovered etc.. And can events like button click , like displaying ...
2
votes
2answers
253 views

Am I doing events right?

My problem is with JavaScript in the browser but I guess it could apply to any event-driven environment. I have coded up a widget in my app. The widget allows a user to select an item using 3 ...
3
votes
1answer
100 views

Assessing Relative Maintainability

We (a contractor, actually) are implementing an off the shelf system to replace a legacy homegrown system for the core domain of the company (designing widgets). Unfortunately both systems will have ...
1
vote
0answers
144 views

Push-Based Events in a Services Oriented Architecture

I have come to a point, in building a services oriented architecture (on top of Thrift), that I need to expose events and allow listeners. My initial thought was, "create an EventService" to handle ...
8
votes
2answers
310 views

How to detect achievements in gaming?

I mistakenly posted this to stackoverflow and now posting here based on a suggestion in on that site ... This is a very high level conceptual question. Say in a software application I have 4 ...
-2
votes
3answers
246 views

Do all programs run in a loop? [closed]

I was wondering whether all programs run in a Loop, checking for variable changes then acting upon said changes followed by another Loop. Or do they run in a While statement, waiting for a variable to ...
1
vote
2answers
161 views

Where is interface between button click and event raising defined

When I click on button, might be in windows apps, web apps, etc it has some animation to actually see it clicked and event is raised in background. I've knowledge of events and its attaching to button ...
-1
votes
1answer
91 views

Automation Approaches: Events/Triggers/Cron [closed]

It has been my experience, when building websites, that most of the logic of a system is executed when user input is accepted, be it via POSTs, GETs etc. I would like to know what processes or ...
2
votes
3answers
282 views

How to document events?

Code documentation is usually related to a piece of code, be it small (method-level) or larger (class- or namespace-level). However, it is always about the inputs and the outputs of that piece of ...
5
votes
2answers
1k views

Event Driven Programming: A sequence of unfortunate events

I have a very basic game loop whose primary purpose is to check for updates & changes to a list. I have contemplated using event driven programming to replace the game loop/list idea with an ...
4
votes
1answer
5k views

What is the difference between routed events and attached events?

I am just going through the WPF concepts I came across these routed events, dependency properties and attached events. What are the concepts behind them and why are they called instead of .NET ...
2
votes
1answer
187 views

Application protocols and state machines: designing a complicated server

I'm designing and prototyping a server that has the following characteristics: during the daemon's initialization it spawns nine "manager" servers, each of which solves one part of the overall ...
2
votes
2answers
269 views

What are the caveats of the event system built on Messenger rather than on classic .NET events?

MVVM Light and PRISM offer messenger to implement event system. the approximate interface looks like the following one: interface Messanger { void ...
1
vote
5answers
236 views

Should I use events in this case?

I'm creating a video player, like a custom YouTube player. All of the GUI elements (progress bar, video player, play button, ...) are different classes, but I obviously need them to communicate. When ...
2
votes
0answers
29 views

what's the difference between Routed Events and Attached Events? [duplicate]

Possible Duplicate: What is the difference between routed events and attached events? I tried to find through various sources but still unable to understand difference between routed events ...
3
votes
1answer
70 views

Event system architecture for networking when performance is concerned

How should I design a system for an action game (think in Golden Axe) where events can happen remotely? I'm using TCP for this because the client is in flash. There's so many options, I can make a ...
8
votes
1answer
397 views

Futures/Monads vs Events

In an application framework when performance impact can be ignored (10-20 events per second at max), what is more maintainable and flexible to use as a preferred medium for communication between ...
3
votes
3answers
902 views

Combining multiple events into one action/ Defer refreshing

So in a GUI program I have multiple events that trigger a update of a workspace. This update call is costly so I would want it to not happen very often. A user might pick something from a dropdown ( ...
8
votes
6answers
1k views

How to ease the maintenance of event driven code?

When using an event based component I often feel some pain at maintenance phase. Since the executed code is all split around it can be quite hard to figure what will be all the code part that will ...
0
votes
1answer
332 views

event source calls methods in a interface

I am using Java. How does an event source like a (button in a GUI) knows which method to call in an interface? For example, I am listening to Mouse Events and have implemented a Mouse Listener ...
7
votes
6answers
1k views

Triggering custom events in AJAX callbacks

I'm pretty new to JavaScript, but one of the things that's been frustrating is that our AJAX callbacks have been getting packed with different functionality, making it difficult to keep everything ...
4
votes
1answer
576 views

Need to process 2 million 100k messages per second and route them to a particular event, delegate or multicast delegate

I need to process 2 million messages per second (perhaps in a scale out configuration) and route each message to a N delegates or multicast delegates. Question How should I structure my application ...
1
vote
3answers
537 views

Event driven design and separation of core/UI logic

I am new to event driven development, and I feel lost when I try to implement events that should pass the core/UI boundary. In my program I have the following (example in c#): UI.RuleForm ...
9
votes
6answers
2k views

Merits of a “Message Passing” system vs. an “Event Based” system

My question is coming from an somewhat uneducated perspective. What are the relative merits of a "message passing" system vs an "event based" system. Why would one choose one over the other? What ...
3
votes
2answers
270 views

How to name event types?

Clean code recommends to name methods to be a verb, and classes to be a noun. I am developing an c++ application using boost::signal as some kind of event framework, and have defined various events, ...
4
votes
1answer
952 views

Which notification pattern is preferable?

I'm working on a view model for a view that presents a dialog with export options. The user selects options then clicks Export. When the view model completes the Export, the calling view model ...
0
votes
1answer
107 views

How should I keep track of an elements' state within a window/view?

I am trying to implement a view that contains many elements, whose state change depending on the actions you perform on it. I guess this is something that people often run into so I would like to know ...