Questions tagged [asynchronous-programming]

175 questions
99
votes
1 answer

Is there really a fundamental difference between callbacks and Promises?

When doing single-threaded asynchronous programming, there are two main techniques that I'm familiar with. The most common one is using callbacks. That means passing to the function that acts asynchronously a callback-function as a parameter. When…
Aviv Cohn
  • 21,190
  • 31
  • 118
  • 178
58
votes
8 answers

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?
47
votes
5 answers

async+await == sync?

Stumbled upon this post that talks about making async web requests. Now simplicity aside, if in real world, all you do is make an async request and wait for it in the very next line, isn't that the same as making a sync call in the first place?
Mrchief
  • 621
  • 1
  • 5
  • 9
39
votes
2 answers

Who did async/await first?

Python added the async/await constructs in 3.5 in 2015. The Javascript community made steps towards it for a bazzillion years and finally added a very similar implementation to the draft in ES8 released in 2017 (From my understanding). Typescript…
Ziv
  • 2,946
  • 5
  • 23
  • 26
32
votes
14 answers

Why don't programming languages automatically manage the synchronous/asynchronous problem?

I have not found many resources about this: I was wondering if it's possible/a good idea to be able to write asynchronous code in a synchronous way. For example, here is some JavaScript code which retrieves the number of users stored in a database…
Cinn
  • 463
  • 1
  • 4
  • 8
29
votes
4 answers

What determines which Javascript functions are blocking vs non-blocking?

I have been doing web-based Javascript (vanilla JS, jQuery, Backbone, etc.) for a few years now, and recently I've been doing some work with Node.js. It took me a while to get the hang of "non-blocking" programming, but I've now gotten used to using…
Sean
  • 393
  • 1
  • 3
  • 4
27
votes
3 answers

How does Javascript code become asynchronous when using callbacks?

I've been doing a lot of reading online trying to figure out how to write asynchronous JavaScript code. One of the techniques that has come up a lot in my research is to use callbacks. While I understand the process of how to write and execute a…
Z. Charles Dziura
  • 729
  • 1
  • 5
  • 9
23
votes
1 answer

Does Akka obsolesce JMS/AMQP message brokers?

I spent the last week deep diving into the Akka docs and finally understand what actor systems are, and the problems that they solve. My understanding (and experience with) traditional JMS/AMQP message brokers is that they exist to provide the…
smeeb
  • 4,820
  • 10
  • 30
  • 49
22
votes
3 answers

API Gateway (REST) + Event-Driven Microservices

I have a bunch of microservices whose functionality I expose through a REST API according to the API Gateway pattern. As these microservices are Spring Boot applications, I am using Spring AMQP to achieve RPC-style synchronous communication between…
22
votes
1 answer

Learning Asynchronous programming

Asynchronous non-blocking event driven programming seems to be all the rage. I have a basic conceptual understanding of what this all means. However what I'm not sure is when and where my code can benefit from being asynchronous, or how to make…
21
votes
3 answers

Calling multiple async services in parallel

I have few async REST services which are not dependent on each other. That is while "awaiting" a response from Service1, I can call Service2, Service3 and so on. For example, refer below code: var service1Response = await HttpService1Async(); var…
Ankit Vijay
  • 1,568
  • 3
  • 10
  • 13
14
votes
1 answer

How can NodeJS be "non-blocking"?

I'm learning NodeJS and just wanted to clarify something. In several introductory tutorials and books so far, very early on they've described Node's "non-blocking" architecture - or rather that it's possible (and recommended, the entire point) to…
Anonymous
  • 3,546
  • 2
  • 25
  • 26
13
votes
1 answer

Blurring the lines between async and regular functions in C# 5.0

Lately I can't seem to get enough of the amazing async-await pattern of C# 5.0. Where have you been all my life? I'm absolutely thrilled with the simple syntax, but I'm having one small difficulty. My problem is that async functions have a totally…
talkol
  • 255
  • 1
  • 8
12
votes
1 answer

Is the C# async/Task construct equivalent to Java's Executor/Future?

I'm a long time Java developer, but with so little traffic on SE, I don't limit my viewing to any single tags. I've noticed that C# questions with async/await come up a lot, and as far as I've read it's the standard (but somewhat recent)…
Kayaman
  • 1,930
  • 12
  • 16
12
votes
2 answers

Efficient mixing of sync and async methods within a single method?

Okay, it sounds odd, but the code is very simple and explains the situation well. public virtual async Task RemoveFromRoleAsync(AzureTableUser user, string role) { AssertNotDisposed(); var roles = await GetRolesForUser(user); …
Ripped Off
  • 3,757
  • 3
  • 21
  • 24
1
2 3
11 12