377 questions for senior .NET engineer interviews, each with a 30-second answer, the full answer, a deep dive, the follow-ups interviewers ask next, and real-world production problems.
DRY, KISS, YAGNI, separation of concerns, cohesion, coupling, Law of Demeter, Tell Don't Ask, fail fast, least astonishment, convention over configuration.
Don't Repeat Yourself as single source of knowledge, not identical text; accidental versus true duplication; the wrong abstraction; where DRY matters most.
Keep It Simple: essential versus accidental complexity, simple versus easy, readable code over clever code, and how to argue for simplicity in design reviews.
You Aren't Gonna Need It: costs of building speculative features, the difference between speculative features and keeping options open, and reversible versus irreversible decisions.
Separation of Concerns at method, class, project and service level; layers versus vertical slices; cross-cutting concerns via middleware and filters; the cost of over-separation.
Cohesion as how strongly the parts of a module belong together; types of cohesion; symptoms such as utility classes and feature envy; measuring with LCOM; refactoring by feature.
Coupling as the degree of dependency between modules; types from content to data coupling; temporal, deployment and database coupling in distributed systems; techniques to reduce it.
Principle of least knowledge: talk only to immediate collaborators; train-wreck chains; why fluent builders and LINQ are not violations; refactoring by moving behaviour.
Tell objects what to do instead of querying state and deciding outside; anaemic versus rich models; invariants; where querying is fine (CQRS reads, DTOs).
Detect invalid state at the earliest point: guard clauses, ArgumentNullException.ThrowIfNull, options validation on start, ValidateOnBuild; fail fast versus resilience at boundaries.
Code and APIs should behave as users expect: naming, side effects, .NET conventions (Try pattern, Async suffix, CancellationToken last), equality, exceptions and defaults.
Sensible defaults that remove boilerplate: EF Core key and relationship conventions, ASP.NET Core routing and configuration conventions; overriding defaults; risks of hidden magic.