Refactoring to Collections
- 27 videos
- 1 book
- 04 h 00 min
"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.
4 Hours of Video
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.
Real Application Code
A copy of the entire Nitpick CI codebase, a production Laravel application that lives and breathes collection pipelines.
Table of Contents
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
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
transpose, and even extending the library with our own custom transformations.
Imperative vs. Declarative Programming
Thinking in Steps
The Problem with Primitives
Arrays as Objects
A Note on Mutability
Quacking Like... an Array?
The Golden Rule of Collection Programming
Pricing Lamps and Wallets
CSV Surgery 101
Binary to Decimal
What's Your GitHub Score?
Formatting a Pull Request Comment
Choosing a Syntax Handler
Tagging on the Fly
Nitpicking a Pull Request
Comparing Monthly Revenue
Building a Lookup Table
Transposing Form Input
Ranking a Competition
Comparing DNA Strands
Building a Table of Contents
Highlighting Code Blocks
A Bit of Theory
A Lot of Practice
No review yet.
I'm Adam Wathan, a full-stack developer, entrepreneur, and Justin's worst nightmare.
I share everything I know about making awesome software through my articles, talks, screencasts, podcast, and courses. Right now I'm working on Tailwind CSS, and I share updates about my progress in my work journal.