# Every Carrier Does It Differently

Three carriers price, label and schedule pickups their own way, and the tracker shouldn't care which one it's talking to.

Updated: November 17, 2026

## [Rates That Need More Than a Function](https://www.ask-codey.com/courses/design-patterns/topics/dp-rates-that-need-more-than-a-function)

1. [Strategy: When the Rule Needs a Class of Its Own](https://www.ask-codey.com/lessons/dp-strategy) (Journeyman): Pass 1 handed the weekly deal in as one function; a carrier's rate needs its own numbers and answers more than one question, so the function grows into a class per carrier, each holding its numbers and keeping one promise, and the quote screen asks whichever carrier it's handed: the Strategy pattern in its classic form.

## [Same Steps, One Step Different](https://www.ask-codey.com/courses/design-patterns/topics/dp-same-steps-one-step-different)

1. [Template Method: Same Routine, Your Own Step](https://www.ask-codey.com/lessons/dp-template-method) (Journeyman): When three label classes copy the same four steps and differ only in the barcode, a fix to the shared steps has to be made three times, and one copy is always missed; writing the routine once in a base class and letting each carrier's subclass fill in its own barcode is the Template Method pattern.
2. [Strategy or Template Method?](https://www.ask-codey.com/lessons/dp-strategy-vs-template-method) (Journeyman): Strategy and Template Method both let one step of a routine vary: Strategy hands the step in as an object or function (has-a), Template Method leaves it for a subclass to fill in (is-a); a look-alike table, a run-time change and a second varying step show what each costs, and why most teams reach for Strategy first.

## [Let Each Carrier Decide](https://www.ask-codey.com/courses/design-patterns/topics/dp-let-each-carrier-decide)

1. [Factory Method: Let Each Carrier Decide](https://www.ask-codey.com/lessons/dp-factory-method) (Journeyman): Pass 1's simple factory picked a class from a name; when shipping runs the same steps for every carrier and needs both a label and a pickup that must match, two simple factories with the same if chain drift apart, so each carrier's subclass decides what to create, with methods the shared steps call: the Factory Method pattern.

## [Exercise: The Shipping Rate Calculator](https://www.ask-codey.com/courses/design-patterns/topics/exercise-dp-shipping-rates)

1. [Exercise: The Shipping Rate Calculator](https://www.ask-codey.com/lessons/exercise-dp-shipping-rates) (Journeyman): Take the operations manager's ticket: a fourth carrier, NightOwl, has written its own rules against the tracker's carrier promise. Change a working rate desk, whose carriers are tangled into one switch, so any carrier it's handed can be quoted, with the tests green throughout.

Source: https://www.ask-codey.com/courses/design-patterns/chapters/dp-carriers
