Part 2 of 6 · 1 min read
The problem
Parts that belong together.
Think of a furniture shop with two ranges, a modern one and an antique one. A customer who buys a modern sofa should get a modern table, not an antique one. The shop wants one decision, "which range", that fixes every item.
GoF's example is a user interface toolkit with several look-and-feel standards. Each standard has its own scroll bars, windows and buttons. If an application hard-codes the widgets of one standard, the look cannot be changed later. And mixing a button of one standard with a window of another gives a broken screen.
The same shape appears in a billing program that runs in two countries. Each country needs a tax rule and a money format. Using the Indian tax with the dollar format would print wrong totals. A set of related objects designed to be used together is a product family.
Product family
A product family is a group of related objects that are designed to be used together, with one version of the group for each variant.
Example: the Indian tax rule and rupee formatter form one family. The US tax rule and dollar formatter form another.
Check yourself: 1. What breaks if the tax of one country meets the format of another? 2. What is the product family in GoF's example?