DOAJ Open Access 2021

Continuations and Aspects to Tame Callback Hell on the Web

Paul Leger Hiroaki Fukuda Ismael Figueroa

Abstrak

JavaScript is one of the main programming languages to develop highly rich responsive and interactive Web applications. In these kinds of applications, the use of asynchronous operations that execute callbacks is crucial. However, the dependency among nested callbacks, known as callback hell, can make it difficult to understand and maintain them, which will eventually mix concerns. Unfortunately, current solutions for JavaScript do not fully address the aforementioned issue. This paper presents Sync/cc, a JavaScript package that works on modern browsers. This package is a proof-of-concept that uses continuations and aspects that allow developers to write event handlers that need nested callbacks in a synchronous style, preventing callback hell. Unlike current solutions, Sync/cc is modular, succinct, and customizable because it does not require ad-hoc and scattered constructs, code refactoring, or adding ad-hoc implementations such as state machines. In practice, our proposal uses a) continuations to only suspend the current handler execution until the asynchronous operation is resolved, and b) aspects to apply continuations in a non-intrusive way. We test Sync/cc with a management information system that administers courses at a university in Chile.

Penulis (3)

P

Paul Leger

H

Hiroaki Fukuda

I

Ismael Figueroa

Format Sitasi

Leger, P., Fukuda, H., Figueroa, I. (2021). Continuations and Aspects to Tame Callback Hell on the Web. https://doi.org/10.3897/jucs.72205

Akses Cepat

PDF tidak tersedia langsung

Cek di sumber asli →
Lihat di Sumber doi.org/10.3897/jucs.72205
Informasi Jurnal
Tahun Terbit
2021
Sumber Database
DOAJ
DOI
10.3897/jucs.72205
Akses
Open Access ✓