1325 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.
God class, long method, feature envy, primitive obsession, shotgun surgery, long parameter lists, tight coupling and inappropriate intimacy: spotting and fixing them.
Defines a code smell versus a bug, groups the classic smells (bloaters, couplers, change preventers, object-orientation abusers, dispensables) and names the ones most common in .NET business code.
Covers the god class and long method smells: their causes in .NET (fat services, handlers and controllers), how to recognise them with metrics and reading, and how to break them up with extract method, extract class and splitting by responsibility.
Explains primitive obsession, the bugs it allows (swapped IDs, unvalidated strings, currency-less money), and how to fix it with readonly record struct IDs, validated value objects and records, including EF Core value converters, JSON serialisation and where to validate.
Covers the feature envy and inappropriate intimacy coupler smells, how they show up in .NET (service methods reading another object's fields, classes reaching into each other's internals, message chains), and how to fix them with move method, tell-don't-ask and encapsulation while keeping entities free of infrastructure.
Explains shotgun surgery, divergent change and tight coupling, how to detect them from git history (files that change together, temporal coupling) and from code (dependency graphs, CA1506), and how to fix them by co-locating behaviour, vertical slices and stable abstractions in .NET.
A code review exercise that names the smells in a realistic .NET service (god class, long method, primitive obsession, feature envy, duplicated code, hidden side effects, dead code), ranks them by severity, and separates must-fix-now comments from items logged as technical debt.