Search code examples
.netasp.net-mvc-4business-logic-layer

Instance methods Vs Static Methods in the business layer


I have a typical web application with the controllers calling the business methods. Should the methods in the business classes be implemented using static methods or instance methods. The business layer classes doe not maintain any state information.

Some additional information + The business classes do not maintain state specific information. + Would instantiating these objects on a per request basis consume a lot of memory as opposed to using static methods


Solution

  • Does "yes" count as an answer? I hate to say it, but both answers are valid; choosing between them requires context. If you have no use for per-instance state, then: why create instances? However, it should be noted that per-instance state is useful for IoC/DI scenarios, which in turn are handy for testing.