📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

πŸ“š .NET Interview Questions

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.

Code Smells

God class, long method, feature envy, primitive obsession, shotgun surgery, long parameter lists, tight coupling and inappropriate intimacy: spotting and fixing them.

  1. How would you find the parts of a large codebase where code smells actually cost the team the most?
    Junior Theory Code Smells
  2. What is a code smell? How is it different from a bug, and which smells do you most often find in real .NET codebases?

    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.

    Junior Theory Code Smells Β· πŸ”— 2 follow-ups
  3. What are the god class and long method smells? Why do they keep appearing, especially in .NET services and handlers, how do you recognise them, and how would you break one up safely?

    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.

    Intermediate Theory Code Smells Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  4. What is primitive obsession? Show how you would fix it in C# with strongly typed IDs, value objects and records, and explain the costs, including EF Core mapping, serialisation and validation.

    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.

    Mid-Level Coding Code Smells Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  5. What are feature envy and inappropriate intimacy? How do you spot them in a C# codebase, and how do you fix them by moving behaviour to the data, without ending up with entities that depend on infrastructure?

    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.

    Mid-Level Theory Code Smells Β· πŸ”— 2 follow-ups Β· πŸ›  1 real-world
  6. What are shotgun surgery and tight coupling? How would you find them using your version control history (change coupling) as well as the code, and how do you fix them in a .NET solution?

    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.

    Mid-Level Theory Code Smells Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world
  7. Code review: you're reviewing a 250-line CustomerAccountService that handles sign-up, loyalty points, invoice emails and CSV export. Name every code smell you find, rank them, and tell me which you would ask to be fixed in this PR and which you would log as technical debt.

    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.

    Senior CodeReview Code Smells Β· πŸ”— 3 follow-ups Β· πŸ›  1 real-world

🌐 Sangam's Webring

βͺ Previous 🏠 Main Next ⏩
πŸ’¬ Chat with me