# Shipments with Many Parts

A shipment can have insurance, a signature, a pickup window and gift wrap, can hold boxes inside boxes, and is often the same as last week's.

Updated: November 17, 2026

## [Step by Step, Then Build](https://www.ask-codey.com/courses/design-patterns/topics/dp-step-by-step-then-build)

1. [Builder: Step by Step, Then Build](https://www.ask-codey.com/lessons/dp-builder) (Apprentice): When a shipment is made with a constructor of nine arguments, half of them false or empty, nobody can read a call and a swapped pair compiles fine; a builder names each step, leaves out what you don't need, and checks the whole thing once, when you build.
2. [Builders the Modern Way: Named Arguments and Records](https://www.ask-codey.com/lessons/dp-builder-modern) (Journeyman): A builder fixes a long constructor, but it's a second class that repeats every field; named and optional arguments, records with with, Python dataclasses and JavaScript object literals do most of its job in the language itself, and this lesson shows when they do and when a builder still earns its place.

## [Ship It Again](https://www.ask-codey.com/courses/design-patterns/topics/dp-ship-it-again)

1. [Prototype: Duplicate, Then Change](https://www.ask-codey.com/lessons/dp-prototype) (Apprentice): When "the same as last week, new address" is made by copying a shipment field by field, the copying code forgets whatever was added since; letting the shipment copy itself fixes that, as long as the copy doesn't share its list of boxes with the original, the bug that shallow and deep copies are about.

## [Boxes Inside Boxes](https://www.ask-codey.com/courses/design-patterns/topics/dp-boxes-inside-boxes)

1. [Composite: Boxes Inside Boxes](https://www.ask-codey.com/lessons/dp-composite) (Journeyman): When the tracker weighs a shipment by asking every item "are you a box or a pallet?", it needs one more nested loop for every level of pallets, and a pallet on a pallet on a pallet gets missed; with the Composite pattern, a box and a pallet answer the same question, and a pallet answers by asking what's on it.

## [Exercise: The Shipment Builder](https://www.ask-codey.com/courses/design-patterns/topics/exercise-dp-shipment-builder)

1. [Exercise: The Shipment Builder](https://www.ask-codey.com/lessons/exercise-dp-shipment-builder) (Journeyman): Take the operations desk's next ticket: a new checkout screen makes shipments one step at a time, and pallets are now stacked three deep. Change the working shipment and weight code so both work, with the tests green throughout.

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