Alex Rivera | Logout

Should you avoid static classes?

Asked 2009-08-22T03:59:54.413
26

Are static classes considered bad practice? I read an article about this a couple days ago (can't find it, sorry) which basically said that having static classes (especially those 'helper' classes) are typically a sign of bad code. Is this correct, and if so, for what reasons?

Edit
Report

1 Answer

2

Here are some links to some google testing blog posts on why static methods can hurt the testability of your code, as well as why static methods (which are the bad part of static classes) introduce all kinds of potentially surprising coupling and interaction between components.

how to think about oo

singletons

static-methods-are-death-to-testability

answered 2009-08-22T04:36:04.370

Your Answer