Blog
Mert Özen's blog posts on software development, backend, frontend, and DevOps.
What Is a Design Pattern? The GoF Catalog, Pattern Anatomy and Patterns That Vanish in Modern Languages
A design pattern is a named solution to a design problem that recurs in a given context, with defined roles and a known price (its consequences); it is not a diagram to memorise. The idea from Alexander to the GoF, the GoF's 13-section template, the purpose × scope map, and Norvig's observation on patterns that turn invisible in C# as yield, event and lambdas.
Iterator and Interpreter: Two Patterns Built into C# — yield return and Expression Trees
Iterator lets you walk a collection's elements in order without exposing its internals, and in C# it is built into the language as IEnumerable, IEnumerator and yield return; Interpreter represents a small language's grammar as an AST and evaluates it. With real output we read a paged catalog API with yield and IAsyncEnumerable, write a small promotion rule language and compile it to an expression tree, look at the interpreter inside Regex and draw the security boundary for dynamic expressions.