The Factory Method pattern
Kitty’s old professor looks at the code and tells her this newer code is an improvement, but she isn’t using a pattern. The simple factory is classified as a programming idiom. Idioms are like patterns, in that they occur frequently. You recognize them when you see one, but they haven’t fully realized any solutions to common problems. Perhaps the most famous programming idiom ever devised was created in Kernighan and Ritchie’s book titled The C Programming Language, also known as The K&R book. It was in this book we saw our very first Hello, World program. Hello, World is an idiom. It usually serves as the first few lines of code you try when you are learning a new language. It doesn’t solve any industrial-grade problems by encouraging flexibility and code reuse.
Kitty realized she’d seen this idiom in her IDE of choice for C#, JetBrains Rider. When you create a console application, like the one she’...