Test Driven Development in Both OOP and FP

Skip Intro, Show me the Vids

I’ve been watching a lot of Dave Farley’s YouTube channel 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 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 and Continuous Delivery. 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 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.

One in particular is Test Driven Development, 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.

Four things for you.

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

Second, here’s the video tutorial series for Test Driven Development in Strictly Typed Functional Programming:

Third, here’s the video tutorial series for Test Driven Development Using Object Oriented Programming in a Dynamic Language:

Fourth, here’s all videos on TDD in a single playlist: