Boxes Inside Boxes
Boxes Inside Boxes: Composite: Boxes Inside Boxes.
Updated
- Composite: Boxes Inside Boxes (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.