Armed with the above type-instantiation information, we can
apply this to patterns and how they are used. Especially in .NET
applications, classes can make use of dynamic references, which are most often
defined in the configuration file. Within this file it is possible to
specify a string containing the type name and assembly, similar to how you see
it already in the .NET Framework. Using the Type.GetType method, it is
possible to obtain a reference to the type, if the framework can resolve
it. And from this, we have our basis for dynamically retrieving the
object reference.
Now we begin to look at the creational patterns that are available. If
you are aware of the book "Design Patterns" by Gamma et. al, this book
specifies five creational patterns that are most widely used when designing
software. We will look at some of those, and perhaps a few others.
Note, most patterns avoid directly instantiating an object through the
constructor, and so the constructor is often declared private or internal. It
is up to you to determine whether you want to expose the constructor, or to
instantiate through another means. Let us begin by looking at the design
patterns.