0% completed
Abstract Factory Pattern
The Abstract Factory Pattern creates families of related objects that have to match, without the code that uses them naming a single concrete class.
Some objects only work with their own kind. A Postgres connection belongs with a Postgres query builder, because Postgres quotes identifiers with double quotes and MySQL quotes them with backticks. A macOS button belongs with a macOS checkbox. A test environment needs a fake payment client, a fake mailer, and a fake clock, all fake together.
If each object is created on its own, nothing stops the wrong pairing. A PostgresConnection and a
.....
.....
.....
Ioana T
· 9 days ago
for the code to match the diagram above with AbstractProduct1 (Drink) & AbstractProduct2 (Pastry), it should show that each CafeFactory house implementations offers (returns) both products (their respectice Product1 & Product2 implementations), not just one of the Product1 or Product2 implementations. They are families of products after all.
Reading Progress
0%