Pro EP 44 : 14 Things that you Should Avoid in Controllers

Muhammad Waseem
Become .NET Pro !
1 min readApr 23, 2023

These are few things that you shouldn’t do in controllers for better performance.

  • Putting HTML
    - SQL statements
    - Tight Coupled code
    - Configuration settings
    - Putting a lot of if-else
    - Accessing database directly
    - Mapping classes in controller
    - Business Logics and Data Access
    - Making too many external API Calls
    - Not using caching (Not all the time)
    - Using synchronous methods everywhere
    - Making God controllers (that does a lot of things)
    - Using static methods instead of dependency injection
    - Putting exceptions in every controller (one could disagree but I will go with global exception handling)

Whenever you’re ready , there are 3 ways I can help you

  1. Subscribe my Weekly .NET Newsletter of C#/.NET with 1950+ Software Engineers.
  2. Promote yourself to 1950+ subscribers by sponsoring my newsletter (Reach me at mwaseemzakir@gmail.com)
  3. Download my eBook at Gum road that contains 30+ .NET Tips (With 950+ Downloads)

--

--