# Design Patterns

Design Patterns: What is a Design Pattern, Factory Method, Iterator.

Updated: November 3, 2026

1. [What is a Design Pattern](https://www.ask-codey.com/lessons/design-patterns-what-is-a-design-pattern) (Apprentice): A design pattern is a proven, named answer to a problem that keeps coming up in software design. Patterns are grouped as creational, structural and behavioral, and you've already used several without knowing their names: Singleton, Iterator, Observer, Dependency Injection and the DAO.
2. [Factory Method](https://www.ask-codey.com/lessons/design-patterns-factory-method) (Journeyman): A factory method makes an object for you, so the code that uses it doesn't name the class it gets. A simple factory picks the class in one switch, instead of in every caller; the Gang of Four's Factory Method lets each subclass decide what to create. ASP.NET Core's registrations with a lambda are factories too.
3. [Iterator](https://www.ask-codey.com/lessons/design-patterns-iterator) (Journeyman): The Iterator pattern lets code walk through a collection without knowing how it's stored. In C#, foreach works on anything that implements IEnumerable&lt;T>, which hands out an IEnumerator&lt;T> with MoveNext and Current. Write one by hand to see how it works, then let yield return write it for you.

Source: https://www.ask-codey.com/courses/csharp-full-stack-bootcamp/topics/design-patterns
