Never miss a beat

Join my newsletter.

Tag: async

Dart's Futures and Streams

Published: 9/26/2020

Asynchronous programming in Dart is an absolute blast. Dart offers a couple of different options when writing asynchronous code: namely Futures and Streams . You can use both Futures and Streams to solve a lot of the same problems, but each serve their own purpose as well. Futures are a type that models a computation who’s value may or may not be available. If you’re unfamiliar with Futures, you can think of getting a receipt at your favorite fast food restaurant as a Future. At some point…

Scheduling background tasks in Play with Scala

Published: 2/13/2018

A common theme with web applications is to run tasks in the background. Commonly, they're ran at set intervals. You'll find data processing servers, online-game servers, and several other types of servers using regularly scheduled background tasks and today, you'll learn how to implement these tasks in Play with Scala.

Using Futures in Clojure

Published: 10/29/2017

It’s late at night so I’ll keep this post short. I’m going to quickly cover how to use Futures in Clojure and why you would want to use them. Let’s start with the why. What is a Future? A future is simply a function that executes code on a background thread and can be dereferenced to get the result of that code. Here’s what they look like! This code will start a new thread, print “foo” and then do the heavy-lifting of calculating 1+1. Keep in mind the result of a future has to be dereferenced…

Introduction to Asynchronous Programming in Clojure

Published: 7/15/2016

I’ve been writing about my favorite language, Clojure, for a while now. I’ve also been gauging your interest in Clojure and, if you’re reading this, I think you’re ready to take this relationship to the next level. Let’s talk about asynchronous code in Clojure. Getting Started If you want to follow along with the code examples, start a new project. I’m going to be using Leinengen and we’re going to name this app “warehouse”. Let’s open warehouse/src/warehouse/core.clj and modify it so it looks…