Questions tagged [event-programming]

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.

Filter by
Sorted by
Tagged with
4 votes
1 answer
3k views

Event-driven architecture and synchronization with a "First-timer microservice"

I'm working on a distributed application and getting deeper into Event-Driven architectures with Microservices. Let's say I have been running two Microservices, CustomerService and AccountService. ...
4 votes
1 answer
990 views

What is so different about RTOS compared to normal programming?

Classical programs run a loop with prioritized ISRs. How do RTOS do this differently of better?
3 votes
2 answers
3k views

Events fired when widgets are updated programmatically

In the GUI application I'm working on I have a number of custom (composite) widgets that I've created, with each widget having an update_gui function where I access my SQLite database so I can fill in ...
0 votes
1 answer
1k views

WCF: Send events between services

I recently worked in a larger project where I touched the topic of distributed systems in the c# world the first time. I found that wcf is fantastic for remote procedure calls, but how do you add ...
6 votes
2 answers
555 views

Best event based architecture for Linux to GUI

I've looked around a bit and probably haven't found the right medium for this question so let me know if there's a different forum I should bother. First, there is an application managed by another ...
15 votes
2 answers
5k views

How do I deal with side effects in Event Sourcing?

Let's assume that we want to implement a small security subsystem for a financial application that warns the users via email if a strange pattern is detected. For this example, the pattern will ...
2 votes
2 answers
354 views

Eventing solutions for Java legacy applications too old for real JMS queue/topic eventing?

What are some architectural solutions that can mimic eventing for systems (Java) that are too old to implement eventing solutions, such as conventional Queue/Topic based JMS messaging? I have a ...
4 votes
3 answers
238 views

Is an event based approach the right way to think about this problem?

I've got one requirement that is: When one employee starts working on a project and when he finishes working on it he must inform the system so that it can generate a report afterwards of how much ...
10 votes
2 answers
6k views

How to create new aggregate root in CQRS?

How should we create new aggregate roots in cqrs architecture? In this example I want to create new aggregate root AR2 that holds reference to first one AR1. I'm creating AR2 using AR1 method as ...
6 votes
1 answer
452 views

How to trigger other events in MVC, once the desired event completes?

What is a technique in MVC that can be used to trigger updates? Namely, When user clicks a button save a product I have this: function saveProduct($product) { $this->repository->...
1 vote
2 answers
181 views

Processing multiple type of messages in multiple ways

In a chat application there may be multiple types of incoming messages to be handled. For example, I have messages of these types: text, link, image, and video. Text and link are handled the same way, ...
30 votes
1 answer
25k views

Why Protobuf 3 made all fields on the messages optional?

The syntax 3 of protobuf made all the fields optional dropping the keywords required and optional from previous proto2 syntax. Reading some comments from developers it seems that it was done for ...
4 votes
2 answers
424 views

Update model chain on event driven pattern

What is the formal name for this specific problem scenario in an event-driven architecture, and what are the common approaches to handle it?: After an action or event is dispatched, several ...
0 votes
1 answer
344 views

Achieve atomicity between two separate systems

I have a lot of cases where I need to persist some information into a database and complete a secondary action using third party system. For example I have a trivial case, to save user information ...
4 votes
0 answers
139 views

Sharing identical events, with differing scopes, between client and server libraries, in a micro-service architecture

I have a shared user repository (id, name, e-mail, password, etc.) exposed as a REST service - and multiple independent websites accessing this REST service (from the back-end) as a means of sharing a ...
3 votes
2 answers
430 views

Where should event debouncing be done, in the emitter or consumer?

Where does it make the most sense to debounce events? Consider the resize event of an internet browser. The browser can fire a myriad of resize events as a user clicks and drags to resize a browser ...
1 vote
2 answers
110 views

In a web application, are Hooks and Event Subscriptions the same thing?

When I look at at some PHP applications, they typically have hooks. Drupal and Wordpress are examples. When I look at an application from the .NET world like Orchard or Umbraco, one subscribes to ...
2 votes
2 answers
2k views

Child object calling a parent's function through a global variable

I have a Session object, of which a single global instance session holds the current session, which can persist itself to the server, handle undos redos etc. The session holds an instance of Objects ...
0 votes
1 answer
893 views

CQRS - Passing aggregate root as argument

So, I have following code: public class CQRSQuestion { public static void main(String[] args) { //received command for algorithm run AlgorithmAR algorithmAR = new AlgorithmAR(...
2 votes
2 answers
198 views

Handling events based on their property

I'm working with an external system which sends event-like data to us. An existing SDK from the third-party guys parses the JSON so in the end we get something like the following class: public class ...
0 votes
0 answers
217 views

Is the HTML / JavaScript event handling exactly the Chain of Responsibility design pattern?

Just except that Chain of Responsibility might go one straight line, but in the HTML event handling, it is first the "capture phase" (capturing), then the "at phase", and then the "bubble phase" (...
-3 votes
2 answers
3k views

Why are event driven languages unsuitable for embedded systems, and what makes a language good for embedded systems? [closed]

I'm doing an essay on this for college and I can't really find sources. So far I've found these: https://www.quora.com/Which-is-the-best-programming-language-for-embedded-system http://www.eetimes....
1 vote
0 answers
83 views

Capturing keyboard events for a limited time

I'm trying to code a kind of simple video game where there are two kind of players: Human Players: They enter an keyboard input CPU Players: A random input is calculated For Human Players there is a ...
0 votes
1 answer
66 views

How to handle events in extended classes?

When one extends a class, how is the proper way of setting code to be executed upon some event of the base class? Should one handle the base class event this way: Public Class Class2 Inherits ...
6 votes
1 answer
550 views

Parallelism when using Azure Functions to update a DocumentDB document

I'm writing a web app which allows users to upload real-estate listings. Part of what this does is allow them to upload photos of the property they're listing. I'm using a micro-service type approach ...
8 votes
4 answers
2k views

How to ensure a method handling each event in an event system?

I have several types of events, for example: abstract class Event { static class KeyPress extends Event { ... } static class KeyRelease extends Event { ... } static class KeyHold extends ...
2 votes
1 answer
427 views

Is it better to dispatch one event or multiple events for remote calls?

In ActionScript the URLLoader class that has seven separate events than can occur after you call the load() method. In the HTTPServive classes there are two events, fault and result. In one of the ...
3 votes
1 answer
3k views

Is it a bad practice to subscribe to an event with an Action

I use a third party library for speech recognition. This library give me access to some classes ( SpeechRecognitionEngine, SpeechRecognitionConfiguration etc) which give me access to some events (...
7 votes
1 answer
1k views

Can event emitters be functional?

For instance, array.map accepts a callback that returns a value. const newArray = oldArray.map(item => doSomethingTo(item)); Promises also accept callbacks that return a value. const ...
3 votes
2 answers
1k views

In an event driven microservice environment, are domain events equal to topics?

A lot of messaging frameworks have the term "topic". In a ddd microservice architecture, do these topics always reflect the domain events?
0 votes
1 answer
361 views

How would you structure a flowchart/data flow diagram for an application that runs on a game engine?

I understand how you create flowcharts or data flow diagrams for simple linear based programming. But how do you design a flowchart for event based programming, like a game that runs on Unity3D? How ...
3 votes
2 answers
199 views

How can I avoid both objects A and B using class C (or is it unavoidable)?

I have the following setup: An object A running as a separate service with its own address (implemented via Pyro package in Python). An object B running as a separate service with its own address. ...
5 votes
2 answers
377 views

Is a promise-aware eventing system desirable?

I'm fully aware that Promises and eventing are both ways to do asynchronous programming, and you can choose either one for a given project. However, in practice, the code base I'm working with is ...
7 votes
6 answers
3k views

How to create a timed-event architecture using a SQL database

The title of my question is general because I feel like this problem is of a general nature, but to set the stage I'm going to provide a specific example. We use a homegrown workflow engine that is ...
2 votes
1 answer
194 views

What pattern should I set for handling event as working item?

I have this business event : "CustomerUpdated" published by my system. I have many application listening to these events, and they do all king of action : sending email, updating the database, ...
1 vote
2 answers
78 views

Proper event driven design when a consumer subscribes to many producers

I have a large number of instances of a class. Those instances can fire an event. The only important thing for that event is which instance fired it. I have another instance of a class (and maybe in ...
1 vote
0 answers
131 views

Sending events down a tunnel, and bubbling them back up

I am working on developing an HTML canvas application, where I need to be able to do my own UI event processing. That's where the stem of this question comes from, but I'd really like to understand ...
18 votes
1 answer
5k views

Should I use a command or an event?

The difference between a command and an event in bus communication seems a little vague to me. I know that commands should be executed once only, while an event can be handled multiple times, but ...
2 votes
1 answer
99 views

ADO.NET - Is it better to handle a combo box or label event, and where should the data be sourced from?

Context I recently wrote a final exam that required using a BindingSource object with ADO.NET to populate a number of combo box and label controls from which the user could perform basic business ...
58 votes
8 answers
9k views

Are events only used for GUI programming?

Are events only used for GUI programming? How do you handle in normal backend programming when something happens to this other thing?
7 votes
3 answers
4k 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 ...
1 vote
1 answer
251 views

“An event can be made of two parts, the event header and the event body.” Is this about event or event notification?

From: https://en.wikipedia.org/wiki/Event-driven_architecture Considering: Events do not travel, they just occur. Are the following statements valid? Event channels are conduits in which events ...
3 votes
1 answer
188 views

How to prevent endles event recursion when using event driven data view?

Consider that you have some graphical interface that represents some data structure. For example a text field: This field is connected to the data structure through events. I tried to make diagram of ...
0 votes
4 answers
2k views

Callbacks without concurrency? [closed]

To sync on the terms I will first give my perspective on what a callback function in the simplest possible terms: A callback function is a function that is executed as a response to a certain ...
7 votes
2 answers
995 views

Ensure that callbacks registration and triggering don't cause infinite recursion

I just spent a long, miserable week debugging a stack-overflow in a C++/Qt application. The fundamental problem was that I had a function that accepted a callback, and in certain cases the callback ...
67 votes
5 answers
28k views

When should I use event-based programming?

I have been passing callbacks or just triggering the functions from other function in my programs to make things happen once tasks complete. When something finishes, I trigger the function directly: ...
1 vote
3 answers
1k views

Use case for async/await?

Background Most of the applications that I write are hour long sequential tests for electronic equipment. The equipment under test has a specification that is a state-machine that looks like... Get ...
1 vote
1 answer
147 views

"Who" should handle side tasks for events?

I'm currently on the process of creating a website/webapp. My application is based on Node JS with the express framework. My core backend concept consists of routers: handle http request. Like [...
19 votes
4 answers
4k views

Event-driven programming: when is it worth it?

Ok, I know the title of this question is almost identical to When should I use event based programming? but the answers of said question have not helped me in deciding whether I should use events in ...
1 vote
1 answer
202 views

For Web front end, if there are 20 JavaScript files loading, how to track down the mouseover handler?

For Web front end programming, since any JavaScript can set up an event listener for "mouseover" or "mouseenter" for an element, if we are to track down what is the code that is responsible for making ...