Suggestions?
Software Engineering Observations
These are some basic software development guidelines that I
believe apply regardless of the end development environment
or language. Most of them are geared toward producing
maintainable bug-free code.
- Coding Environment
- Use a source code control system -
Having the capability to check-in revisions makes it much easier to
code. Heck - there should be multiple items on Configuration
Management here.
- Use the error checking capabilites of your compiler -
There is no reason NOT to compile with all the warnings enabled. (and
then FIX all the warnings that are reported) If the
compiler is complaining about it, then there is probably a problem.
- Have another coder review your code/design -
Besides finding incorrect or confusing code this also has the
benefit of making somebody else familiar with the code.
- Don't expect Test/QA to find errors in your code
The job of Test/QA is mainly to make sure that the "fixes" you added
didn't break something else. It is the developer's job to generate
and execute tests for their code.
- Coding Style
- Minimize the use of global variables -
In general the use of a global variables is a bad idea. They are
difficult to maintain and easy to misuse.
- Document algorithms in the code. -
If you include a comment indicating how the algorithm is supposed
to work then it is much easier for others to determine if the
algorithm is correctly implemented in the code.
- Check input for errors/invalid/out of bounds -
This includes making sure input is within range and valid.
If it isn't valid then make sure it is handled in some way
(ie raises an error or is set to default value)
- Handle returned error conditions -
If a called function/routine returns an error code, then
make sure it is checked and handled by the calling code.
- Use meaningful variable/function names -
The use of cryptic or irrelevant names makes it significantly
harder to debug problem code.
- Be wary of hard-wired values in comparisons -
If you have a number or string embedded in a compare operation
then you should consider extracting it out to a defined constant.
(Especially if it is used in multiple places.)
Software Engineering Books on my shelves
There are 3 files uploaded here that show my coding style. |
 Updating...
David Fandel, Nov 28, 2012, 11:30 AM
David Fandel, Nov 28, 2012, 11:30 AM
David Fandel, Nov 28, 2012, 11:30 AM
|