I’m in an all day set of meetings today to talk about how we’re going to make our legacy web framework testable in the next version of the application. It’s going to be a cool project to do.
One of the first things you notice about this codebase is the central class. It’s an obvious blob class. How do I know it’s a blob? First off, I counted 31 “usings” statements at the top of the class file. Then I see business logic, HTML, javascript, and database manipulation all happily jumbled together in an ASP.NET user control. My very first recommendation is basic surgery. “Extract Class” here I come.
I don’t know what I’d say for a hard limit to the number of namespace references, but if you’ve got a bunch you probably better start thinking about splitting up the class.
Let’s all say it together — “One class, one responsibility.” Someday I’m gonna make this my very first tattoo.