I wrote an article a while back for TechTarget / SearchWinDevelopment about static methods being a code smell. It got published a few weeks ago and here’s a link to read it.
Static methods are a code smell
by Ben Day
02.26.2010Ever heard of code smells? A code “smell” is a way of saying that there is potentially a problem with your code. It doesn’t mean that you’ve definitely made a mistake or that you’re definitely wrong for doing something wrong, it just means that you *might* be doing something wrong. At the moment, Wikipedia says that it is “any symptom in the source code of a program that possibly indicates a deeper problem.”
One of the common smells that I come across is static method and variables. (In VB.NET these are known as “Shared” methods.) If you mark a method as static, this means that the method now belongs to the type rather than an instance.
…
-Ben
Leave a Reply