Our New Code Setup

Let's rewrite our previous application in a functional style to improve its readability and testability.

We'll cover the following

Overview

Let’s turn theory into practice and rewrite the application in a functional style, using techniques from earlier chapters to improve aspects like the readability and testability of the application. Our goal is to start using the composition of pure functions as much as possible while avoiding mutation. The result undoubtedly won’t be perfectly functional. In spirit, though, it will be far removed from the first version. Furthermore, just to be clear, we are rewriting the application, not refactoring it, as that would be piece by piece, keeping the existing application up and running. Rewriting is simpler to explain and allows for easier side-by-side comparisons.

Setup

We’ll start by showing our new and improved Pet Service before explaining what we did. The setup.sh is unchanged except for the name of the stack. The infrastructure is basically the same, although the location of the Lambda Zip and handler has changed.

Get hands-on with 1400+ tech skills courses.