Our New Code Setup
Explore rewriting an application by applying functional programming principles using TypeScript and fp-ts. Understand how to structure code with pure functions, optimize Lambda setup, and organize domain-driven folders to enhance maintainability and testability while avoiding mutation.
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 ...