Getting Creative with Creational Patterns
Creational patterns deal with creating objects, a process we call instantiation. Remember, an object is a class that has been instantiated. Objects only exist in running programs. They are built from blueprints called classes. Since C# is a static language, you can’t generally change the structure of an object once it has been instantiated, which means you should use the best strategy to create your objects. That’s what we’ll be discussing in this chapter.
Even if you’re new
to software development with C# (that might be the first pun in the book that relies only on formatting to be funny), you already know the simplest way to instantiate an object from a class. You simply use the new
keyword and invoke the class’s constructor:
var myConcreteClass = new ConcreteObjectThingy();
That’s instantiation. You’re creating an instance of a class that acts as the point where the class turns into...