SN

April 9, 2018

Functional Core, Imperative Shell

In Gary Bernhardt’s talk, “Boundaries”, he discusses the idea of a functional core, imperative shell.

Functional Core

This layer of your application is made up of functions that take some values, and return a value. The functions aren’t concerned with state, writing to the database, talking to the network, and so on.

The functional core makes up the majority of your application.

Imperative shell

This is the layer of the application that handles talking to the network, writing to disk, state, etc.

That’s a quick and dirty summary of the functional core, imperative shell. Watch the talk to get a deeper understanding.

I like this idea. It means that the majority of your tests are simple unit tests that cover the functional core, with a few integration tests that test the shell. And that means we’ll have a fast test suite.

That being said, I’m not sure how this might look while using a framework like Laravel.

I’ll have to run some experiments, and share what I find.

Are you new to Test Driven Development?

Join the mailing list! :)