Indian tax, German invoice
transcript
Picture a checkout that serves two countries. A German customer pays Indian tax. And gets an Indian invoice number. Nobody picked wrong. Each part was picked alone.
Every country has its own payment method. A tax rule. And an invoice numbering. Three parts that only make sense together. Mix them, and no compiler complains.
Give each country one kit. One kit creates all three, and they match. The checkout picks a kit once, from the country code in config. So the three always come from one country.
India kit: 18 percent of 1000 is 180. The total is 1180. Germany kit: 19 percent is 190. The total is 1190.
A new country is one new kit class. The checkout is untouched. A new kind of product, say a receipt, edits every kit.
Abstract Factory is for matching families, not for single products. Pick the kit once. The parts always match.
Full breakdown in the lecture.