I had a problem and tried to use Java, now I have a ProblemFactory.
–Old Java joke.
This chapter covers two GoF patterns at the same time: Factory Method and Abstract Factory. These patterns are closely related, so we’ll discuss them together.
Let’s begin with a motivating example. Support you want to store information about a Point in Cartesian space. So you go ahead and implement something like this:
So far, so good. But now, you also want to ...