CS 4960
Fall Semester 1999

 
Programming Tips

 
  1. Don't write a big program when a little one will do.
  2. Rework repeated code into arrays
  3. Be familiar with advanced data structures
  4. Let the data structure the program
  5. When you need a little speedup, work at the best level
  6. When you need big speedup, work at many levels
  7. Writing correct programs requires:
    1. Coding Skill
    2. Problem Definition
    3. Algorithm Design
    4. Data Structure Selection
    5. Coding Environment Support
  8. When testing, introduce errors that tests are meant to catch and see if they work.
  9. Save efficiency concerns for when it matters
  10. If efficiency matters, profile; then address efficiency atcorrect level.
  11. Some issues to consider when designing a code as solution to a problem:
    1. How is code to be used?
      1. Library call
      2. Shell command
      3. C++ class
      4. particular machine
    2. What charcteristics should it have?
      1. Semantics of return value
      2. Range of return value
      3. Operating domain
      4. Initialization
      5. State saving
    3. What testing should be done?
      1. Embedded tests
      2. Validation tests
      3. Test mechanism
    4. Documentation?
      1. In-line
      2. External
      3. Web browser
    5. What coding standard should be used?
      1. Variable names
      2. File names
      3. Function names
      4. Comments
      5. Embedded constants
      6. #defines
      7. in-line coding
    6. Debugging?
      1. Standard method
      2. Compile flags
      3. Run time flags
      4. Macros
    7. Prototypes?
      1. Suitable language
      2. Elimnate most coding
      3. Rapid
      4. Leads to understanding