Question

What's the term for an error caused by executing a block of code before its relevant ajax response has come back? e.g., a timeline:

13:00:01 execute getDataViaAjax();

13:00:02 execute doSomethingWithMyAjaxData();

13:00:03 ajax data comes back, too late since I forgot to make the code wait for it...

I have a feeling I may say "doh!" when someone tells me the answer, but I can't for the life of me think what type of error it might be called.

Was it helpful?

Solution

It's simply called an asynchronous error since this relates to incorrect asynchronous behavior.

The data was managed in a synchronous fashion when it's the result of an asynchronous event. So the handler function executed before another function finished.

Asynchronous Error

What is asynchronous programming? It's defined as a one-way operation. Which means code sends a signal one-way into an object and there is no immediate signal sent back. So either it's a black-hole or you attach a handler to listen for a signal to come out later.

What is an asynchronous error? It is a problem with how the object triggers handlers for the one-way signal. They could be fired to soon, to late or not at all.

Synchronous Error

What is synchronous programming? It's defined as a two-way operation. Code sends a signal into an object and the object sends a response signal back.

What is a synchronous error? It's an error related to the two-way signals that define a synchronous operation. For example; a web browser connects to a web server, and the web server send a HTTP response before the web browser sends a HTTP request.

Synchronization Error

Synchronization error is what happens when two objects fail to achieve the same equal state. Think of synchronizing two databases on a fail-over server. If the second machine doesn't keep it's database identical to it's master, then it's a synchronization error.

Licensed under: CC-BY-SA with attribution
scroll top