34: Matt Machuga - Dealing with Dependencies in Active Record Models

Full Stack Radio

In this episode, Matt Machuga of Think Through Math returns to talk with Adam about design options when you find yourself wanting access to a collaborator in an Active Record or Eloquent model. They discuss the pros and cons of four specific designs, and finish off with their personal recommendations.

Topics include:
  • Are facades and service location automatically bad?
  • Are NounVerber classes anti-OO?
  • Adding a layer of composition to create domain models with dependencies
  • Using method injection for a temporary dependency
  • Using optional parameters to improve testability
Code snippets:Links:

Audio Player

-
--:--
--:--