Skip to main content

When NOT to Extract: Avoiding Over-Engineering

Premium
4 min read

Throughout this course, I've shown you many structural patterns: Form Requests, DTOs, Services, Actions, Pipelines, Jobs, Events, Listeners, Traits, and Helpers. That's a big toolbox.

But here's the thing: you don't need to use all of them in every project. In fact, reaching for a pattern when you don't need it is just as bad as putting everything in the Controller.

This lesson is about knowing when NOT to extract.


You Don't Need an Action for Simple CRUD

If your Controller method is just this:

public function store(StoreUserRequest $request)
{
$user = User::create($request->validated());
 
return redirect()->route('users.index');
}

That's fine. You don't need a CreateUserAction class for this. The logic is two lines, it's clear, it's not reused anywhere. An Action class would add a file, an import, and indirection — for zero benefit.

Extract when there's a reason to extract:

  • The logic is complex (more than a few lines)
  • The logic is reused from multiple places
  • The logic has side effects that need testing

Events Add Indirection — Use Them When You Need Decoupling

Events and Listeners are powerful, but they....

The Full Lesson is Only for Premium Members

Want to access all of our courses? (34 h 11 min)

You also get:

58 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

No comments yet…

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.