David Gómez García

David Gómez García

Biography

David has been working in Software development for more than 20 years, taking part in projects for different projects in sectors like Banking, Defense, Services & Retail, Maritime and ground transport. Currently is one of the organizers of the Madrid Java User Group and part of the technical committee for Lambda World (a functional programming conference). He was recognized as JavaChampion in January 2020.

Leverage CompletableFutures to handle async queries.
The challenges of developing applications recently have increased. With the popularity of cloud environments, the scalability required by new architectures and the need to support more load efficiently, there has been an increase in attention that we need to pay to concurrency and efficiency. One strategy to achieve that efficiency consists of distributing the modules of your application in several different smaller components running concurrently. But one of the problems that arise from such distribution of running modules comes when you need to send a request (and wait for the response) to several different modules. How do you design that request(s)-response(s) to be as efficient as possible? Completable futures were introduced in Java 8, and they are a powerful mechanism to add concurrency (not parallelism) to your application logic, and it may be handy when dealing with multiple queries to different systems. If you are a developer, you may make your code more performant by using CompletableFutures where it makes sense. If you are a library developer, it may be a good thing to offer an API that returns CompletableFutures so that your users will be able to benefit from it.