Review: Refactoring to Collections

Adam Wathan from Full Stack Radio recently published an e-book and set of screencasts called Refactoring to Collections.

The pitch is simple:

"Refactoring to Collections" is a book and video course that teaches you how to apply functional programming principles to write clean, maintainable PHP.

Learn how to use collection pipelines to break down ugly, complex functions into a series of simple transformations, free of loops, complex conditionals, and temporary variables.

Whilst the concept functional programming, collections, closures, pipelines etc have been around for a long time I feel like they're only recently making it into the vocabulary of many PHP developers.

Something that I certainly struggled to comprehend when I was first introduced to collections was 'Why do I want to use the each method when I can use foreach on an array?'.

In the functional programming world there are many theories which can seem convoluted to beginners. Once you see how they are applied to real problems the intimidation disappears.

Adam does a great job of explaining these concepts using snippets from projects that he has worked on. Getting rid of switch statements by using a lookup table collection is neat.

Is this book for seasoned developers? No. But I don't get the impression that was the intention.

I feel the intention of this book was to provide a sidekick for people who think of programming as much more than a hobby, but a craft. And part of that craft is knowing how and when to apply very powerful techniques to solve certain problems.

I personally haven't been through the exercises and screencasts, but if you're new to the game I'd trust that Adam delivers.

Do I have anything bad to say? Not really. I think it works for the audience it was intended for. If anything, it reads less like a textbook and more like a set of blog posts.

Given the book is digital I feel like it's priced slightly too high. But, I can see how he has justified it. I've never written a book, but I've watched friends and family. And it's not easy.

So, if you don't know what a collection is, how to harness it's power and want an introduction to some basic functional programming concepts grab a copy.


Read more posts by this author.