Articles by Erin Swenson-Healey

Erin Swenson-Healey

Erin Swenson-Healey

An Introduction to ADTs and Structural Pattern Matching in TypeScript

Preface To quote Rúnar Bjarnason: One of the great features of modern programming languages is structural pattern matching on algebraic data types. Once you’ve used this feature, you don’t ever want to program without it. You will find this in languages like Haskell and Scala. I couldn’t agree more myself. That said, I spend most

Erin Swenson-Healey

Erin Swenson-Healey

Composing Synchronous and Asynchronous Functions in JavaScript

Our example application implements a function createEmployee that is used to create an employee from a personId. To create an employee, our system loads some data from our database, validates that data, and then performs an insert. Some of our functions are written in continuation-passing style (they accept a callback) and some are written in

Erin Swenson-Healey

Erin Swenson-Healey

Gettin’ Freaky Functional w/Curried JavaScript

Partial application refers to the practice of filling in a functions parameters with arguments, deferring others to be provided at a later time. JavaScript libraries like Underscore facilitate partial function application – but the API isn’t for everyone. I, for one, feel icky sprinkling calls to _.partial and _.bind throughout my application. Curried functions (found

Erin Swenson-Healey

Erin Swenson-Healey

Tidying Up a JavaScript Application with Higher-Order Functions

Higher-order functions are functions that can do one or both of the following: Take a function or functions as arguments Return a function as an argument Most programmers by now are familiar with higher-order functions such as map, reduce, and filter. These functions abstract away the boilerplate when processing collections. For example… Given a string-capitalizing

Erin Swenson-Healey

Erin Swenson-Healey

Composing Data Pipelines: (Mostly) Stateless Web Applications in Clojure

I describe building an application in a functional style as the act of composing many smaller, context-free functions into pipelines of data transformations which map from system inputs to outputs. Compojure (a Clojure web application library similar to Bottle and Sinatra) represents this input as a simple, immutable hash map which is transformed through a

Erin Swenson-Healey

Erin Swenson-Healey

Bacon.js + Node.js + MongoDB: Functional Reactive Programming on the Server

In this article, we’ll demonstrate usage of the Bacon.js library, implementing a Node.js chat application in functional reactive programming style. We’ll use the Socket.IO chat application example as our baseline, adding on some additional asynchronous workflows, interaction with MongoDB, error handling, and logging.

Lights
Erin Swenson-Healey

Erin Swenson-Healey

An Incremental Migration from Rails Monolithic to Microservices

Your Rails application has become a monolith. Your test suite takes 30 minutes to run, your models grow to several hundred (or thousand!) lines, and feature development slows to a crawl. New members of your team must read through massive amounts of code before they can feel confident making changes. You’ve watched Uncle Bob’s Architecture

Erin Swenson-Healey

Erin Swenson-Healey

New Hat Meets Old: Polyglot Distributed Systems with Barrister RPC

Connecting the components of a distributed systems is no easy feat. Should I use REST? An RPC system like Apache Thrift? Protocol Buffers? SOAP? How do I document these components’ APIs? What’s the best way to write client bindings? The Internet offers a wide array of possible solutions, all of which I’ve found to be

Erin Swenson-Healey

Erin Swenson-Healey

A Lack of API Documentation Considered Harmful

As someone who consumes many web service APIs – both internal and external – the recent trend in the web development community to forgo writing API documentation has got me worried. While I do understand that publishing and maintaining documentation can be a hassle, APIs with no documentation can quickly become a bottleneck in a

Erin Swenson-Healey

Erin Swenson-Healey

Micromessaging: Connecting Heroku Microservices w/Redis and RabbitMQ

While attempting to deploy a system of interconnected microservices to Heroku recently, I discovered that processes running in dynos in the same application cannot talk to each other via HTTP. I had originally planned on each microservice implementing a “REST” API – but this wasn’t going to be an option if I wanted to stick