Monday, November 06, 2006

Conquering complexity

Techniques to defeat the biggest problem you have in software development: complexity. Adapted(again) from "Code Complete 2".
  • divide the system into subsystems at architecture level so you can focus on a smaller amount at a time
  • design class interfaces to ignore inner workings(encapsulation, one of the best tools one can get)
  • making a consistent abstraction, so you don't have to remember arbitrary details
  • avoid global data because it adds to the amount of code you have to juggle at one time
  • avoid deep inheritance. It is intellectually demanding
  • avoid deep nesting of loops and conditionals, to avoid killing processor time and gray matter
  • avoid gotos - they break the linearity, making code hard to follow
  • carefully define your approach to error handling. You will use a proliferation of arbitrary techniques otherwise
  • do not allow classes to become monster classes
  • keep the routines short
  • use clear, self-explanatory variable names
  • minimize the number of parameters passed to a routine
  • use conventions, to spare your brain the challenge of remembering arbitrary, accidental differences between different sections of code

No comments: