Creational Patterns
Four creational patterns (AbstractFactory, Builder, FactoryMethod,
and Prototype) deal with the construction of complex objects.
They are useful when the objects come in different flavors, or
families, of related components. For the purpose of the following
exercises, the "complex object" is an computer account and a
corresponding security manager. (This is not really complex,
but the focus is only on the structure of the patterns.)
Problem (2.1)
The complex objects of this problem come in several flavors referred to as
"economy", "standard" and "professional".
The differences between these flavors concerns the resources that
an account can use, e.g.:
| Econ | Std | Pro |
Hours months |
60 | 150 | unlim |
Connect speed |
56 | 56 | unlim |
Mailboxes |
1 | 3 | 5 |
Storage |
5 | 12 | 50 |
A security manager is an object associated to an account.
It monitors that an account does not use more resources than allowed.
A user is an object that contains an account and its associated
security monitor.