Mert Özen Go Beyond the Code

Blog

Posts and series that take software and IT from the basics to advanced topics: from programming languages and databases to architecture and AI.

Series
1990 posts found
From Class Diagram to Code and Back: Domain Model, Design Model and puml-gen
Software Design PART 06

From Class Diagram to Code and Back: Domain Model, Design Model and puml-gen

A domain model shows business concepts without types or operations, while a design class diagram shows the C#-level design decisions for the same case; the first is drawn by hand, slices of the second become code, and diagrams generated from code with tools like puml-gen are for observation and drift checks only. The post takes Bookstore's institutional ordering module from diagram to EF Core configuration and DDL, then back to PlantUML with puml-gen.

7 Nov 2026 14 min 64
Class Diagrams 2: Association, Aggregation, Composition, Generalization and Dependency — with C# Equivalents
Software Design PART 05

Class Diagrams 2: Association, Aggregation, Composition, Generalization and Dependency — with C# Equivalents

An association is a lasting link and becomes a navigation property in C#; in a composition the part has one owner and is deleted with it, which in EF Core means an owned or complex type or cascade delete; aggregation has no precise meaning in UML 2.5.1. The notation and C# counterpart of six relationships, EF Core's cascade default on required relationships, qualified associations, and why PurchaseApproval is promoted from an association class to a class of its own.

7 Nov 2026 15 min 85
Class Diagrams 1: Classes, Attributes, Operations, Visibility, Multiplicity and Stereotypes
Software Design PART 04

Class Diagrams 1: Classes, Attributes, Operations, Visibility, Multiplicity and Stereotypes

Every marker in a class diagram is a decision in code: [0..1] is a nullable type, [0..*] a collection, a slash a computed property, an underlined line a static member, and {readOnly} a field that never changes. The three compartments of a class box, attribute and operation syntax, the corners where visibility does not match C#, interfaces, enumerations, data types and stereotypes, and the same diagram in Mermaid.

7 Nov 2026 13 min 78
Use Case Diagrams and Specifications: Actors, include, extend and the Cockburn Template
Software Design PART 03

Use Case Diagrams and Specifications: Actors, include, extend and the Cockburn Template

A use case diagram shows the system from outside: actors are roles, use cases are goals; the include arrow goes from the base to a mandatory step, the extend arrow from a conditional addition to the base. The use case diagram of Bookstore's institutional ordering module, the Place Order specification in Cockburn's fully dressed template, mapping use cases to user stories and API endpoints, and the same diagram in Mermaid.

7 Nov 2026 14 min 82
From Requirements to Diagrams: Which Question Does Each Diagram Answer?
Software Design PART 02

From Requirements to Diagrams: Which Question Does Each Diagram Answer?

Every diagram answers one question: use cases answer who does what, class diagrams which concepts exist, sequence diagrams who calls whom, and state machines which states an object goes through. The requirements of Bookstore's institutional ordering module, extracting candidate classes, use cases and guards from nouns, verbs and conditions, choosing the level of detail by audience, and the map of the series.

7 Nov 2026 12 min 56
What Is UML? A Short History, the 14 Diagrams of UML 2.5.1 and Which Ones You Will Actually Use
Software Design PART 01

What Is UML? A Short History, the 14 Diagrams of UML 2.5.1 and Which Ones You Will Actually Use

UML is the OMG's standard modeling language for putting the model scattered through your code into a notation everyone reads the same way; its current version is UML 2.5.1 from 2017, which defines 14 diagrams, 7 structure and 7 behavior. A short history from the method wars, the diagrams people actually use, the difference between model and diagram, and Fowler's sketch, blueprint and programming language modes.

7 Nov 2026 12 min 72
Code-Level Patterns Beyond GoF: Null Object, Specification, Result and Pipeline
Software Design PART 25

Code-Level Patterns Beyond GoF: Null Object, Specification, Result and Pipeline

Four patterns outside the GoF catalog pay off constantly in everyday C# code: Null Object and Special Case turn the "nothing" case into an object with behavior, Specification carries a business rule as a combinable Expression that EF Core can translate to SQL, Result chains steps into a failure-aware flow, and Pipeline splits transformations into ordered filters. Plus why a rule written as a Func pulls the whole table.

7 Nov 2026 17 min 63
Anti-Patterns: God Object, Service Locator, Singleton Abuse, Anemic Domain Model and Patternitis
Software Design PART 24

Anti-Patterns: God Object, Service Locator, Singleton Abuse, Anemic Domain Model and Patternitis

An anti-pattern is a solution that looks reasonable at first but produces the same trouble again and again, and recognizing one means knowing the refactoring that moves it to a better structure. The dependency Service Locator hides from ValidateOnBuild, a God Object measured with CA1506, singleton tests that break depending on order, an anemic model whose rule gets bypassed, Golden Hammer, Lava Flow, Poltergeist and patternitis.

7 Nov 2026 14 min 78
Visitor Pattern: Double Dispatch, ExpressionVisitor and a Comparison with Pattern Matching
Software Design PART 23

Visitor Pattern: Double Dispatch, ExpressionVisitor and a Comparison with Pattern Matching

Visitor doubles C#'s one-dimensional virtual dispatch through Accept and Visit calls, letting you add new operations to a stable type hierarchy without touching the elements; the price is that a new type breaks every visitor. The static-type trap of overload resolution, the expression problem, ExpressionVisitor and Roslyn's CSharpSyntaxWalker, and a comparison with switch expressions that have no exhaustiveness check.

7 Nov 2026 12 min 71
Template Method Pattern: Algorithm Skeletons, Hooks and the Delegate-Based Alternative
Software Design PART 22

Template Method Pattern: Algorithm Skeletons, Hooks and the Delegate-Based Alternative

Template Method fixes an algorithm's skeleton in a non-overridable base class method and leaves the varying steps to abstract methods or empty hooks. The hook silently skipped by a forgotten override (CS0114), Stream.CopyTo and BackgroundService.ExecuteAsync whose behavior changed in .NET 10, the virtual-call-in-constructor trap (CA2214), and building the same flow with delegates through composition.

7 Nov 2026 13 min 72
Strategy Pattern in Depth: Keyed Services, IEnumerable<IStrategy> and Func for Runtime Selection
Software Design PART 21

Strategy Pattern in Depth: Keyed Services, IEnumerable<IStrategy> and Func for Runtime Selection

Writing a strategy is easy; choosing the right one at runtime is the hard part: keyed services select by a single key, IEnumerable<IStrategy> with CanHandle looks at several properties of the object, and Dictionary<string, Func<>> selects with the least ceremony when formulas have no dependencies. How registration order silently changes prices, why keyed registrations don't show up in GetServices, and IComparer and StringComparer as strategies in the BCL.

7 Nov 2026 12 min 93
State Pattern: Managing Order States with State Objects Instead of switch
Software Design PART 20

State Pattern: Managing Order States with State Objects Instead of switch

The State pattern moves behavior that varies with state out of the switch in every method and into one class per state; when the base class's default answer is "not allowed", a forgotten state becomes a loud exception instead of a silent bug. Starting from code where a new OnHold state lets an order ship, we look at state classes, the compiler's async state machine, a switch expression alternative and loading the state from an enum column in EF Core.

7 Nov 2026 13 min 59
Blog Map