Design Judgment
Choosing between composition and inheritance, interfaces and abstract classes, records, classes and structs, mutable and immutable types, domain models and DTOs.
-
Composition or inheritance: how do you decide which to use in a C# design? Walk through the criteria you apply, a case where inheritance is the right answer, and how you would refactor a hierarchy that has gone wrong.
Design judgement on composition versus inheritance: is-a versus has-a, Liskov, number of variation axes, framework extension points, and refactoring a broken hierarchy to composition.
Senior
Architecture
Design Judgment
Β· π 3 follow-ups Β· π 1 real-world
-
Interface or abstract class: how do you choose in modern C#, now that interfaces can have default implementations and static abstract members? Give the criteria, real BCL examples of each, and when you would use both together.
Design judgement on interfaces versus abstract classes in C# 14: state, multiple implementation, versioning, default interface methods, static abstract members, and the interface-plus-base-class pattern.
Senior
Architecture
Design Judgment
Β· π 3 follow-ups Β· π 1 real-world
-
Record or class: how do you decide which to use for a given C# type? Explain the criteria, typical examples on each side, the pitfalls of choosing wrongly, and how the decision interacts with EF Core, serialisation and caching.
Design judgement on records versus classes: value versus identity semantics, immutability, inheritance, EF Core entities, JSON contracts, cache keys and pitfalls of each wrong choice.
Senior
Architecture
Design Judgment
Β· π 2 follow-ups Β· π 1 real-world
-
Struct or class: how do you decide in C#, and how do you prove the choice was right? Explain the criteria, the costs on each side (copying, boxing, allocation, GC), the defaults you would recommend, and how you would measure the impact.
Design judgement on structs versus classes: semantics first, size and copying, allocation and GC, boxing risks, readonly and ref structs, and measuring with BenchmarkDotNet and allocation profiling.
Senior
Architecture
Design Judgment
Β· π 3 follow-ups Β· π 1 real-world
-
Mutable or immutable types: how do you decide in a C# system? Explain the benefits and costs of immutability, the C# tools for it (readonly, init, records, immutable and frozen collections), the difference between read-only and immutable, and where mutability is still the right choice.
Design judgement on mutability: thread safety, caching, reasoning and hash keys versus allocation cost; readonly, init, records, ImmutableArray, FrozenDictionary; read-only views versus true immutability.
Senior
Architecture
Design Judgment
Β· π 3 follow-ups Β· π 1 real-world
-
Domain model versus DTO: what is the difference, why should you keep them separate, and how do you map between them in a .NET application? Discuss over-posting, API versioning, EF Core entities and when sharing one type is acceptable.
Design judgement on domain models versus DTOs: responsibilities, boundaries, over-posting and data leaks, versioning, mapping options (manual, Mapster, Mapperly, projections) and pragmatic exceptions.
Senior
Architecture
Design Judgment
Β· π 2 follow-ups Β· π 1 real-world
-
Rich domain model or anemic domain model: what is the difference, what problems does an anemic model cause, and how would you move a .NET codebase towards a richer model without over-engineering it?
Design judgement on rich versus anemic domain models: behaviour with data, invariants, transaction scripts, when anemic is acceptable, and incremental refactoring with EF Core.
Senior
Architecture
Design Judgment
Β· π 2 follow-ups Β· π 1 real-world