Great article Eric.
Zac Braddy
1

I had a particularly crazy action creator that I’ve been meaning to blog about. Depending on a variety of conditions, it needed to perform one or more of a certain collection of ajax calls and other “impure” things. My solution for that case was to create a pure function that returned a list of “instructions”. All of the tricky logic was in the pure function, so it was really easy to test.

At that point the actual action creator was only responsible for calling the pure function and then stepping through the instructions it returned. You could see what that code was doing at a glance and we just tested that via manual and integration tests. Again, all of the tricky logic was in the pure function and fully tested.

This idea is not mine. It is roughly equivalent to a “free monad”.

A single golf clap? Or a long standing ovation?

By clapping more or less, you can signal to us which stories really stand out.