Functions should do one thing, do it well, do it only

  • One level of abstraction per function
  • Functions must not have side effects
  • Functions should have as few arguments as possible
  • Avoid flag arguments, i.e. “boolean isModerator” Instead define two operations if possible.
  • DRY Code
  • Stepdown Rule
  • Command Query Separation Principle