Return to profile for David Hayes

Banishing Loops with Functional Programming

50 minute intermediate seminar


Do you like heavily nested loop-ridden code? Me neither! Here's the good news: your code doesn't have to be that way. Functional programming can help!

In this talk we'll cover how you can banish for and foreach loops from your code by better understanding the most common and accessible functional programming concepts: map, filter, and reduce. We'll draw out concrete examples in PHP that will let you filter down complex data (like arrays of fetched posts) in simpler ways than you may have thought possible. We'll show practical refactorings of hard-to-follow code into better functional PHP and JavaScript.

We'll also cover what functional programming is---it's more than just the "function" keyword---and how it can unlock whole new ways of thinking about the code we write.