Skip to main content
147 votes
Accepted

How does an event listener work?

Unlike the polling example you provided (where the button is checked every frame), an event listener does not check if the button is pushed at all. Instead, it gets called when the button is pushed. ...
Robert Harvey's user avatar
56 votes

How does an event listener work?

An event listener akin to an e-mail newsletter subscription (you register yourself to receive updates, whose transmission is later initiated by the sender), rather than endlessly refreshing a web page ...
Alexander's user avatar
  • 5,195
38 votes

How does an event listener work?

The short, unsatisfactory answer is that the application receives a signal (the event) and that the routine is only called at that point. The longer explanation is a bit more involved. Where do ...
Sklivvz's user avatar
  • 5,250
26 votes

Why do modern operating systems *ever* have perceptible input (keyboard/mouse) lag?

As you may have noticed, there's a category of application that tries really hard to avoid input lag and only occasionally fails at doing so: games. Even then it's not uncommon for players to notice ...
pjc50's user avatar
  • 15.3k
25 votes

Why do modern operating systems *ever* have perceptible input (keyboard/mouse) lag?

I would like to answer this question from more of a high-level, marketing perspective than a more low-level, technical one. All of the current mainstream Operating Systems are so-called general ...
Jörg W Mittag's user avatar
21 votes

How does an event listener work?

Terminology event: A type of thing that can happen. event firing: A specific occurrence of an event; an event happening. event listener: Something that looks out for event firings. event handler: ...
Nat's user avatar
  • 1,101
20 votes

Why do modern operating systems *ever* have perceptible input (keyboard/mouse) lag?

Why can't (or why don't) operating systems absolutely prioritise user input (and repainting thereof) in threading and process scheduling? Even if the operating system tells the application about the ...
Caleth's user avatar
  • 12.4k
18 votes

Why is there a shift towards asynchronous and event driven programming?

The "async" approach better facilitates human reasoning. When most people drive, they don't need to concern themselves with how every element of the car is interacting. Forget the tires - ...
TheRubberDuck's user avatar
11 votes

Why do modern operating systems *ever* have perceptible input (keyboard/mouse) lag?

In my experience, on most computers I have ever used, this is usually caused by inappropriate swapping to disk. Every other cause (such as operating system locks) is significantly less common. When ...
Stack Exchange Broke The Law's user avatar
10 votes

How can message queues improve scalability?

It's not that queues are more scalable, its the fact that two services communicating through queue means the communication is asynchronous. Asynchronous communication is far more scalable than ...
Matan Shabtay's user avatar
10 votes

Why is there a shift towards asynchronous and event driven programming?

Fundamentally the answer comes down to the fact that threads are not free. There is overhead associated with each thread. I found this article which is written by former Intel Engineer Arch D. ...
JimmyJames's user avatar
  • 30.9k
9 votes

How does an event listener work?

Pull vs Push There are two main strategies to check if an event happened, or a specific state is reached. For example, imagine waiting for an important delivery: Pull: every 10 minute, go down to ...
Matthieu M.'s user avatar
  • 15.3k
8 votes

Why is there a shift towards asynchronous and event driven programming?

A lot of event driven programming is because the applications are event driven. You're running code to handle a button click, or a received packet, or a timer expiring. That sort of code is actually ...
Karl Bielefeldt's user avatar
7 votes

Dealing with data arriving at a different times

Don't view the result as the outcome of a request, but as the followup of an event. The question doesn't specify much so I can only speak in abstract terms. I believe the following to be the best ...
Lacey's user avatar
  • 161
7 votes
Accepted

Temporal logic as a programming language paradigm?

TLA+ isn't so much a general purpose language, but... One of the benefits of using TLA+ to investigate the bug is that once you can reproduce the bug, it’s easy to try alternative fixes. The bug in ...
Robert K. Bell's user avatar
6 votes

What is so different about RTOS compared to normal programming?

By not treating all Interrupt Service Routines (ISR's) as the highest priority. The kernel of an RTOS is preemptible where as a GPOS kernel is not preemptible. This is a major issue when it comes to ...
candied_orange's user avatar
6 votes

Can an aggregate only ever consume commands and produce events?

aggregates consume commands and produce events: What is the foundation for this rule? In DDD, the Aggregates are the only one that are allowed to mutate the system state, so they are the only one ...
Constantin Galbenu's user avatar
5 votes
Accepted

How can I emulate Signals and Slots found in Qt, to Javascript / Typescript Classes?

Signals and slots are an implementation of an event system or of the observer pattern. Those are not tied to C++ but can be implemented in any language. Unfortunately, naive implementations of the ...
amon's user avatar
  • 136k
5 votes

What's the difference between reactive programming and event driven architecture?

Event-driven architecture (EDA) is an architectural pattern that promotes the production, detection, consumption of, and reaction to events. They are usually broadcasted through notification messages. ...
Denis FB's user avatar
  • 209
5 votes

Why is there a shift towards asynchronous and event driven programming?

Why is there a shift towards asynchronous and event driven programming? My explanation would be that the tooling have become better. While many operating systems have had support for asynchronous IO ...
JonasH's user avatar
  • 6,329
4 votes
Accepted

Guaranteeing transactions with multiple Listeners

You pass the same transaction to every participant. Then they use the same transaction and still don't know each other. Obviously, now they (or at least their result) is coupled, but having either all ...
nvoigt's user avatar
  • 9,230
4 votes
Accepted

What is the relationship between event driven design and state machines/charts?

Events represent change of state. If the state is your age in years, your birthday is the event that changes it. If you model a state machine with a graph, the various states are represented by ...
null's user avatar
  • 3,767
4 votes

Aggregating events in event-driven system

Whether it breaks the event-driven paradigm should not be your primary concern. The question is if this solves your business problem. There are a number of questions that need to be answered: If A ...
doubleYou's user avatar
  • 2,867
4 votes
Accepted

Whats a proper way to design a GUI event system?

For this answer I will assume that widgets are not, and cannot be operating system windows. Appetizer: keyboard input. The idea is that some widget has keyboard focus. You keep track of what widget ...
Theraot's user avatar
  • 9,261
4 votes

What's the difference between reactive programming and event driven architecture?

Reactive Programming A number of people have identified an increasing importance of a certain combination of desired properties for a certain kind of modern large-scale software systems. In concert, ...
Hyggenbodden's user avatar
4 votes
Accepted

What is the right way of using event aggregator/message bus?

While what you say here may be true Basically everything is decoupled from everything (at least semantically) By having this "God class", you also reduce cohesion because you concentrate ...
Sebastian Sotto M.'s user avatar
4 votes

Why is there a shift towards asynchronous and event driven programming?

IME you're arguing from a false premise. Your "classic" threads with blocking I/O model was popularized by Java, which was the first widely-used language to have standardized built-in thread ...
Useless's user avatar
  • 12.9k
4 votes

Why do modern operating systems *ever* have perceptible input (keyboard/mouse) lag?

Why? Because, generally speaking, nobody cares enough to make it better. And by "caring enough" I mean cares enough to throw some serious money at it. Things begin with synchronous ...
Kuba hasn't forgotten Monica's user avatar
3 votes
Accepted

How do I not lose the "reactive" nature of my services, simply because one of the services isn't reactive?

Guess it's a bit late but here is what I would do : I would put a wrapper around your part and the blackbox. This wrapper will handle the creation of the jobs and the pulling. You have to make it qo ...
Walfrat's user avatar
  • 3,536

Only top scored, non community-wiki answers of a minimum length are eligible