--- title: 'Write functional code when it benefits you' tweet_id: '1272826462031286272' thread_slug: laravel-clean-code-tactics author_username: samuelstancl images: - 'https://pbs.twimg.com/media/Ean8cQUWoAEjdO3.jpg' created_at: 2020-06-16T09:40:51+00:00 slug: write-functional-code-when-it-benefits-you --- Functional code can both clean things up and make them impossible to understand. Refactor common loops into functional calls, but don't write stupidly complex reduce()s just to avoid writing a loop. There's a use case for both.