If Class A has a hard dependency on class B, then I can't mock it out. Now
I'm not just testing A, I'm also testing B.

That sounds like a good definition of when to use static classes and when
to use singletons.

Like Shawn, I use static classes for utility code fragments, but only where
the code has no dependencies on code outside of the framework. If the
class becomes more complex, it becomes a singleton.

John

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to