Test Driven Development in Both OOP and FP
Tags: tdd, testdrivendevelopment, elm, javascript
Published: 2021-05-16 20:19:09


---
title: Test Driven Development in Both OOP and FP 
published: true
description: My new video series showing Test Driven Development in both Object Oriented Programming and Functional Programming, using both strict types and dynamic types.
tags: tdd,testdrivendevelopment,elm,JavaScript
canonical_url: https://jessewarden.com/2021/05/test-driven-development-in-oop-and-fp.html
cover_image: 
---

[Skip Intro, Show me the Vids](#skip)

I’ve been watching a lot of [Dave Farley’s YouTube channel](https://www.youtube.com/channel/UCCfqyGl3nq_V0bo64CjZh8g) lately, and it’s spawned a lot of gears in my head. One in particular is “translating OOP people”. Specifically, our software industry will say things, and many times the speaker will assume they’re talking to an Object Oriented Programming audience. They’re drop words like “abstraction”, “coupling”, or “Bounded Context” as if that’s the way things are done, supposed to be, and everyone just needs context.

[Dave Farley](https://www.davefarley.net/) is super smart, has a lot of experience, and has been at the core of some monumental events in our industry. Things like the [Reactive Manifesto](https://www.reactivemanifesto.org/) and [Continuous Delivery](https://martinfowler.com/bliki/ContinuousDelivery.html). So while I don’t agree with his OOP bent, it’s clear a lot of what he teaches is applicable to Functional Programming as well, and transcends programming style and language choice.

This idea has been burning in my head for awhile to spawn a campaign to help translate useful concepts that are universally applicable regardless of programming language. [Domain Driven Design](https://martinfowler.com/tags/domain%20driven%20design.html) is on my list after Continuous Integration & Continuous Delivery, for example. Currently many in our industry have an OOP flavor to them, but that should NOT dissuade FP developers. I’m referring specifically to architecture, not things that are OOP centric or vaporous like [SOLID](https://en.wikipedia.org/wiki/SOLID).

One in particular is [Test Driven Development](https://www.martinfowler.com/bliki/TestDrivenDevelopment.html), also called Red Green Refactor. I’m still a n00b at it, but have felt the benefits enough times that I’m convinced, in both FP and OOP. So I created a new video series that covers Test Driven Development in both Functional Programming using sound types, and Object Oriented Programming using a dynamic language. I wanted to illustrate:

1. You can use TDD in both OOP and FP; it’s useful in both styles of programming.
2. types are great, but so are tests. Together, they rock and using just 1 isn’t enough.
3. If you don’t have types, you can still be successful. Tests in this case can compensate a little and help you.
4. Having a test suite should empower you to refactor without fear, and you should be excited to do so, not fearful and nervous.

While I continue to have, and battle, my FP bias, I hope these video lessons show you the value of TDD regardless of which style you use, and inspire you to practice and teach others. My hope is it’ll result in better code… or the next best thing we should be doing instead.

<a name="skip"></a>

Four things for you.

First, here’s the 1 minute explainer of what Test Driven Development / TDD / Red Green Refactor is:

{% youtube 35x0kQ2L3oU %}

Second, here’s the video tutorial series for [Test Driven Development in Strictly Typed Functional Programming](https://www.youtube.com/watch?v=QMb-z2L_OYA&list=PLZEZPz6HkCZnChZ1m2xwVjMMdVf8W84fS):

{% youtube QMb-z2L_OYA %}

Third, here’s the video tutorial series for [Test Driven Development Using Object Oriented Programming in a Dynamic Language](https://www.youtube.com/watch?v=lbFP4iFqk00&list=PLZEZPz6HkCZntqOj1sMXm3ejKUHCOJDrg):

{% youtube lbFP4iFqk00 %}

Fourth, here's [all videos on TDD in a single playlist](https://www.youtube.com/watch?v=35x0kQ2L3oU&list=PLZEZPz6HkCZlW0X1BDh5LEU32CL7viZ6K)