I | TFPL | Think First - Program Later
Getting thru the "code" goes much faster if the fundamental design is well defined. It also results in easier maintenance, not to mention might work as expected. |
II | D | Document
Brief but thorough documentation is essential unless you want to own the program for the rest of your life. |
III | TDA | Top-Down Approach
With all due respect to entity-relationships, data flow diagrams, flow charts (showing my age), OOP and OOD, the human mind seems to do better with hierarchical organization than with any other. Even the MFCs from the almighty Microsoft follow this. |
IV | CSN | Common sense names
Verbs for functions, nouns for variables, and adjectives for flags. Use a prefix or suffix to identify the data type association. |
V | SC | Source control
Even small projects can benefit from automated source control. SCCS, PVCS, SA, or VizSS provide an audit trail of changes and have the notion of a project release. Going back is sometimes the only way to discover how an error got into an otherwise functioning piece of software. |
VI | TW | Test wrappers
Testing all functional sub units independently prior to integration with the entire system saves a lot of time a frustration. |
VII | AT | Avoid Tricks
Completely resist the urge to elegantly program a complex sequence in a single statement. Try to make it understandable to someone else. |
VIII | C | Consistency
Within a module, class, or function, use a consistent style. Easier to read, easier to fix. |
IX | S&S | Syntax and Symantics
Get the syntax and symantics correct before producing output. Output from a computer always looks official, but it isn't necessarily correct. Then, ensure the output is correct. Compare to selected manual calculations - on paper (of all things). |
X | B | Backup
Hardware can fail. Always make backup copies and store them safely. Test them for the ability to restore. |
Credit to Dr. Henry Ledgard for most of the above. His books on Programming Proverbs for Fortran, Cobol, and other languages are esteemed above any other books on programming techniques and style. He has obviously produced several programs that could hurt a man's pride. But, he learned and shared it. Most recommended reading, especially in this day of multi-megabyte software.