Login | Register Construx Home
Code Complete, Second Edition
Chapters: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 28 29 30 31 32 33 34 35
   Contents Chapter 7 Checklist: High-Quality Routines
Chapter 7: High Quality Routines

Big-Picture Issues

  • Is the reason for creating the routine sufficient?
  • Have all parts of the routine that would benefit from being put into routines of their own been put into routines of their own?
  • Is the routine's name a strong, clear verb-plus-object name for a procedure or a description of the return value for a function?
  • Does the routine's name describe everything the routine does?
  • Have you established naming conventions for common operations?
  • Does the routine have strong, functional cohesion-doing one and only one thing and doing it well?
  • Do the routines have loose coupling-are the routine's connections to other routines small, intimate, visible, and flexible?
  • Is the length of the routine determined naturally by its function and logic, rather than by an artificial coding standard?

Parameter-Passing Issues

  • Does the routine's parameter list, taken as a whole, present a consistent interface abstraction?
  • Are the routine's parameters in a sensible order, including matching the order of parameters in similar routines?
  • Are interface assumptions documented?
  • Does the routine have seven or fewer parameters?
  • Is each input parameter used?
  • Is each output parameter used?
  • Does the routine avoid using input parameters as working variables?
  • If the routine is a function, does it return a valid value under all possible circumstances?

Other Code Complete Resources

See Also: