Whip Monstrous Code Into Shape
You did your best, but somehow that User object, over time, morphed into a monstrous God object. And your controllers started out nice and clean, but now... not so much.
We've all been there. In this series, we'll review a number of ideas for whipping convoluted code into shape.
Series episodes
Consider Form Objects
19m 39sLearn how form objects manage validation, authorization, and persistence. Build one from scratch and explore Laravel’s form request classes.
Consider Use Cases
13m 11sExplore how applying use case thinking directly in code can clarify user interactions and improve your system’s design and functionality.
Consider Domain Events
16m 18sExplore how using domain events and listeners can help you build complex, maintainable functionality in your application with ease.
God Object Cleanup #1: Pass-Through
4m 45sTame your God User object by extracting related methods into dedicated objects. Learn pass-through techniques for cleaner, maintainable code.
God Object Cleanup #2: Traits and Socks
7m 59sClean up bulky God objects by extracting traits. Learn how organizing code like sorting socks leads to cleaner, more maintainable classes.
God Object Cleanup #3: Value Objects
9m 19sClean up messy classes by extracting value objects wisely. Learn when and how to refactor for cleaner, maintainable code in this Laracasts lesson.
Consider Policies
16m 32sSimplify complex authorization by using policy objects in Laravel—reuse named logic for cleaner, more maintainable controller code.
Consider Splitting Tasks into Steps
11m 31sLearn how to break complex tasks into manageable steps by extracting each into its own class for cleaner, more maintainable code.
Consider Strategizing
12m 29sDiscover how to simplify complex conditional logic using strategies for cleaner, more maintainable code in real-world Laravel applications.
Consider Normalizing
15m 29sLearn how to clean up messy code by normalizing values with smart refactors, extracting logic for clearer, maintainable, and flexible workflows.
Consider View Models
11m 5sLearn how to simplify repeated view logic by creating reusable view models in this friendly, practical Laracasts tutorial!
Too Many Method Parameters is a Sign
8m 52sLearn why methods with many parameters signal a design issue and how to spot opportunities for cleaner, smarter code in this friendly Laracasts lesson!
Consider Decorating
9m 4sLearn how to clean up code by adding dynamic behavior with decorators in this easy, friendly Laracasts tutorial—boost your coding skills today!
Consider Fluent Interfaces
10m 3sDiscover the power of fluent interfaces with clear examples and practical tips in this friendly, engaging Laracasts tutorial!
Hands On Refactoring
18m 18sApply proven refactoring techniques to real code in this hands-on Laracasts lesson—boost your skills with practical, friendly guidance!
Staying True to the Seven Resourceful Methods
14m 42sKeep your Laravel controllers clean and efficient! Learn how to split bloated resourceful controllers into focused, manageable ones.
Consider Query Objects
4m 12sSimplify complex Eloquent queries by using query objects—keep controllers clean and your Laravel code organized with easy, reusable classes.
Consider Refactoring Your Views
12m 49sRefactor your views like PHP classes—learn clean, organized template techniques to improve readability and maintainability in your projects.
Consider a Guest User Class
9m 3sSimplify user checks in your views by creating a Guest User class—clean up your code and handle signed-in logic with ease.
Consider Wrapping it Up
8mLearn to wrap API JSON responses in simple POPO classes to cleanly add behavior and formatting—keep your views and helpers tidy.




