Saturday, February 18, 2012

Code Refactoring Principles

Code refactoring is, and should be, a regular activity in SDLC. If done right, certain patterns emerge.
  • In a multi-layered / multi-tiered code structure, code typically moves from upper layers to lower layers
  • In a multi-module code structure, code typically moves from "specific" module to "common" module
  • Code typically moves from static methods to instance methods. e.g., Formatter.doFormat(MyObject.getDataField()) -> MyObject.getFormattedDataField()
  • Because of improved abstraction, API input/output tend to get chunky (course-grained) rather than chatty (fine-grained).

No comments:

Post a Comment