concept temporal dependency in category functional programming

appears as: temporal dependencies, temporal dependency
Functional Programming in JavaScript

This is an excerpt from Manning's book Functional Programming in JavaScript.

  • The creation of temporal dependencies among your functions
  • 8.1.1. Creating temporal dependencies among functions

    Consider a function used to perform an AJAX request to fetch a list of student objects from the server. In figure 8.1, because getJSON is asynchronous, the function returns as soon as the request is sent and gives control back to the program, which subsequently invokes showStudents. But at this point in time, the students object is still null because the slower remote request hasn’t yet completed. The only way to ensure that the right order of events transpires is to create a temporal dependency between the asynchronous code and the action to take next. This involves including showStudents in the callback function so that it’s executed at the right time.