Java 8: Completable Futures and Asynchronous Pipelines
Smith, Nolan Michael
:
2015-07-29
Abstract
As the meteoric rise of publicly available web service APIs enables access to increasing amounts of useful data via network requests, and network requests are best handled asynchronously, asynchronous and concurrent programming in applications is becoming commonplace. However, current solutions use abstractions that, when performing pipelines of asynchronous operations, lead to poorly architected interfaces in code. The goal of this project is to discuss new abstractions intended to alleviate the pitfalls involved in asynchronous programming and present an example of sound interface design in an asynchronous Java 8 client-server application environment. The application uses Java 8 to construct a dependent network of computations that invoke publicly available web services to plan an eventful weekend at a destination city.
Given a budget and a destination city, the application retrieves flights, tickets to events, and fun public places to visit. Most importantly, the application emphasizes asynchronous interfaces that enable code to be modularized, easily read, and to minimize the latency felt by the user.