1

Is it a good practice to use Static Classes / Methods?

Adding Static members makes unit testing/mocking difficult and not a good SOLID oop practice.

I would recommend use of static only for extension methods.

What are your thoughts? When should one use and not use static ?

razlebe
  • 7,134
  • 6
  • 42
  • 57
Snehal
  • 329
  • 3
  • 14
  • possible duplicate of [When to Use Static Classes in C#](http://stackoverflow.com/questions/241339/when-to-use-static-classes-in-c) – Enrico Campidoglio Dec 03 '10 at 22:08
  • If you are talking about Java, static classes do not make unit testing more difficult. In fact, static nested classes might be more testable compared to inner classes because they can be created without creating an instance of the enclosing class. – NamshubWriter Dec 05 '10 at 13:01

0 Answers0