Refactor

When to Refactor

Today I found a class file that had been created with 1161 lines in it. Files this big should immediately ring alarm bells because the class they contain is almost certainly doing too many things. Class files this big are inevitably difficult to test and sure enough the test file was about 1700 lines.

Some guidelines on when to refactor:

  • The class is doing more than one thing.
  • You can't get a method on one screen.
  • There is poor on non existent documentation.
  • There is poor or no unit testing.
Syndicate content