Designing Dependencies: The Problem

Episode #110 • Jul 27, 2020 • Subscriber-Only

Let’s take a moment to properly define what a dependency is and understand why they add so much complexity to our code. We will begin building a moderately complex application with three dependencies, and see how it complicates development, and what we can do about it.

Previous episode
Designing Dependencies: The Problem
Next episode
Locked

Unlock This Episode

Our Free plan includes 1 subscriber-only episode of your choice, plus weekly updates from our newsletter.

Sign in with GitHub

Introduction

Today we are going to begin a series of episodes on “designing dependencies.” We’ve talked about dependencies quite a bit on Point-Free in the past, starting over 2 years ago when we introduced the idea of dependency injection and how it can be made quite easy by packaging all of your dependencies up into one mega struct. And then earlier this year we showed how to bake that notion of dependency injection directly into the Composable Architecture so that each feature of your application precisely describes exactly what dependencies it needs to do its job, and then as you decompose your app into smaller and smaller components you simply describe how to slice up the entire world of dependencies into just the subset a particular component needs.

There are some really powerful ideas in those episodes, but what we haven’t done yet is discuss exactly how to design dependencies when you are writing code in this style. We’ve shown a few hints of how to do this, for example we strongly recommend forgoing classes, protocols and manager objects, and instead use simple data types. It can be a little uncomfortable to disband with those tools since they’ve been in our tool belt for so long, but there is a lot of power in doing so. So, we want to spend a little bit more time with this style of dependencies and show how to wrap some pretty complex functionality in simple data types instead of using protocols, and we’ll show that this unlocks some truly amazing functionality.

What is a dependency?


References

Downloads

Get started with our free plan

Our free plan includes 1 subscriber-only episode of your choice, access to 62 free episodes with transcripts and code samples, and weekly updates from our newsletter.

View plans and pricing