Futures vs. Promises
Codemia Knowledge Hub ·
Promises
A Promise, on the other hand, is a mechanism to write asynchronous code in a more synchronous fashion. A Promise embodies both the task itself and a way to control its execution, meaning you both initiate the computation and retrieve the eventual result in the same object. Formerly, Promises existed primarily in web development but have since evolved to other languages and libraries.
Example of Promise in JavaScript
Key Differences
Related reading
- Futurevoid async vs simply void async in Dart
- GAE-ready asynchronous operations in Python?
- General query about Callback functions and Threads
- Generator return doesn't work in for-await-of loop
- Generate a Hash from string in Javascript
- Generate SHA-1 for Flutter/React-Native/Android-Native app
- Get a list of all threads currently running in Java
- Get HTTP headers in asynchronous WebClient request
Course lessons on this
System design interview problems on this topic
- Design a Distributed Locking System: solution and walkthrough
- Design a Distributed Counter: solution and walkthrough
- Design Ticketmaster: solution and walkthrough
- Design a Flash Sale System: solution and walkthrough
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseNo course covers this one yet
Basis Lab writes one for you from a sentence about what you want to be able to do, then teaches it and checks you understood. Your first course is free.
Build my courseInterview Questions practice on Codemia
Over 11,000 interview practice questions for 300+ companies, searchable by company and role.