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