Managing Dependencies

Episode Summary

This week we talk about recognizing dependencies, isolating dependencies, and managing dependency direction.

Episode Notes

Chapter 3: Managing Dependencies

To collaborate, an object must know something about others. Knowing creates a dependency. If not managed carefully, these dependencies will strangle your application

Recognizing Dependencies

An object has a dependency when it knows:

Writing Loosely Coupled Code

Inject Dependencies

see 1_inject_dependencies.rb

It's is not the class of the object that's important, it's the message you plan to send to it.

Isolate Dependencies

see 2_isolate_dependencies.rb

Isolate Instance Creation

Isolate Vulnerable External Messages

Remove Argument-Order Dependencies

see 3_remove_arg_orer_dependencies.rb

Use Hashes for Initialization Arguments

Explicitly Define Defaults

Managing Dependency Direction

Choosing Dependency Direction

Depend on things that change less often

John’s pick - Pick Krisp -