Skip to content
34: Matt Machuga - Dealing with Dependencies in Active Record Models episode artwork

Jan 27, 2016 38 min

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

from Full Stack Radio Hosted by Adam Wathan

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: Option 1: Facades/Service Location/Global Access Option 2: Moving the responsibility to a new class Option 3: Composing a new domain model Option 4a: Inject the dependency into the method Option 4b: Optional method injection w/global fallback Links: Matt's blog "Agent nouns are code smells" by Peter Gillard-Moss Nitpick CI, Adam's PSR-2 style checking service "Dependency injection is not a virtue" by DHH Erie Day of Code, Matt's conference Sponsored by Laracasts

Episode details come from the podcast's RSS feed.

Embed this episode

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.

Ready to play

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

0:00 38:43

No transcript yet.

Requests help us decide what to transcribe next.

Frequently asked questions

How long is this episode of Full Stack Radio?

This episode is 38 minutes long.

When was this Full Stack Radio episode published?

This episode was published on January 27, 2016.

Can I download this Full Stack Radio episode?

Yes. Use the download control on the episode player to save the publisher-provided media file.