"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.
No introduction, personal anecdotes or stories about my childhood. Just real-world, practical refactoring content, right from page one.
Every refactoring example from the book covered in even more depth, as well as three additional advanced tutorials, making up almost 2 hours of content on their own.
A comprehensive set of 25 exercises in the form of unit tests, to practice your chops and make sure you have these patterns under your fingers.
A copy of the entire Nitpick CI codebase, a production Laravel application that lives and breathes collection pipelines.
“I wrote the library used in this book, and I still learned dozens of tricks that have improved my code. This is the definitive resource for programming with collections.”
Taylor Otwell
Creator of Laravel
Refactoring to Collections includes over 4 hours of screencasts, covering 16 different refactorings that are broken down into 27 videos.
“Adam's use of real-world examples for the more confusing collection transformations makes them approachable for anyone. I cannot recommend Refactoring to Collections enough.”
Matthew Machuga
Senior Developer at Think Through Math
The first section of the book focuses on teaching you the theory and fundamentals you need to to start applying functional programming principles to your code.
You'll learn about the difference between imperative and declarative code, how to use higher order functions to remove duplication, and how to reimplement fundamental operations like map
, reduce
, and filter
from first principles.
The second section of the book and the companion screencasts are a deep dive into problem solving with Laravel's Collection library.
Through 16 in-depth examples, we walk through everything from beginner to expert level problems, using advanced operations like zip
and transpose
, and even extending the library with our own custom transformations.
Very cool guide to collection pipeline programming from @adamwathan https://t.co/YqlWNt7PZx
— Michael Feathers (@mfeathers) May 20, 2016
Great deal at any level, but trust me, you want the screencasts. Also, get it even if you aren’t a PHP dev. I’m not. https://t.co/IodGp2QV9y
— Eric Peterson (@_elpete) May 18, 2016
.@adamwathan has changed the way I write code. His new book 'Refactoring to Collections' is an amazing resource! pic.twitter.com/qlbt6Sj0w8
— Mark Johnson (@_marklj) May 20, 2016
I’m about 20 pages into @adamwathan ’s book on collections and it’s already paid for itself twice over in tricks to save time and sanity.
— Daniel Matthews (@danmatthews) May 19, 2016
The video & book package are phenomenal - addictive even :) Learnt so much in such a short time. https://t.co/4TC371Rp1h
— Ashley Wharton (@Ashley_J_W) May 20, 2016
Got my copy, I can't say enough good things about this book. I highly recommend this for all developers! #knowledge https://t.co/4I2igYO9vb
— Karl Monson (@karlmonson) May 20, 2016
Get a peek at the content. Enter your email address and I'll send you a sample PDF containing a chapter of fundamentals, as well as a refactoring from the second half of the book.
“After reading this book, every loop is now an opportunity to write cleaner, more expressive code. Adam does a marvelous job of unpacking this topic in simple terms. Even better, he provides more examples than you can shake a stick at. So good!”
Jonathan Reinink
PHP League Contributor
Hey! I'm @adamwathan, senior web application developer, host of Full Stack Radio, and creator of Nitpick CI.
I teach everything I know on my blog, through screencasts, and at conferences around the world.
I don't use Laravel, will this product still be useful to me?
100% absolutely yes! All of the principles in this book are not only cross-framework, they are even cross language. Everything you learn from "Refactoring to Collections" will help you write better code everywhere you go.
What content is included in the screencasts that's not included in the book?
The screencasts cover all of the refactorings from the book, plus 3 additional problems that aren't included in the book. The screencast-exclusive examples are "Comparing DNA Strands", "Building a Table of Contents", and "Highlighting Code Blocks."
The three additional examples are really advanced problems, and make up well over an hour of content. You'll learn a ton from those examples!
Can I purchase multiple licenses for my team at a reduced price?
Yes! Click here to check out the team licensing packages. You can buy licenses of the Premium Training Package for teams of up to 5, 10, or 20 depending on what fits your needs.
What am I allowed to do with the Nitpick codebase?
The Nitpick codebase is provided for educational purposes only. This means it's not okay to host a copy of the app anywhere, distribute the code online, etc.
Is the book available in ePub or mobi formats?
Right now the book is only available in PDF format. I'm right in the middle of polishing a responsive HTML version, and then I plan to look into adding ePub and mobi. Anyone who purchases the book will receive any new formats as soon as they're ready.
The reason for starting with PDF is that I wanted to do a lot of somewhat fancy formatting in the book to make the code samples easy to follow. HTML and PDF made this easy, but I'm still unsure how well I'm going to be able to translate it to more restrictive formats like ePub and mobi.
I have another question!
Sure! Shoot me an email at adam.wathan@gmail.com and let's chat!
© 2016 Adam Wathan. All Rights Reserved.
Proudly hosted with DigitalOcean.