User:AVS/Refactoring Rules

From VCMI Project Wiki
Jump to: navigation, search
  1. No code duplication.
  2. No magic nombers
    1. use constant if value comes from code (mostly for enums)
    2. use configuration if value comes from configuration (text ids from general text handler).
    3. use configuration for widgets
    4. use string value to retrieve configuration parameters.
  3. Low coupling
    1. include only indispensable headers
    2. try use all classes from included headers. Consider refactoring if U use only small part of "known classes"
  4. (*) (!) we need automated testing to use refactoring heavily.