Monday, April 05, 2010

Code Refactoring rules

Composed methods

Technical debt - not a bad thing, but pathological case, yes
interest you pay: is the compromises you have to make,
demo trumps discussion

Draw a chart of complexity/line of code over time.
IPlasma , Cyclomatic complexity a swing app to compare your code complexity against industry std.

Pay attention to dependencies on external tools and libs
Choose composition instead of inheriing from external classes.
Inheriting means you can;t use that code else where

Law of demeter violoation: Only talk to your closest friend, not firend's friend

List like inheritance hierarchy: good examples

Sublclasses do not redefnine methods, so use composition instead of inht

Afferent coupling: (how may clases are using this class) measure by CKJM,
Weighted methods per class: WMC < 10 is best
Find classes that are high in AC and WMC and refactor those.

Factoring: making changes to the code outside

Book: Refactoring databases

Multi-threading