Being an electronics/software engineer who has worked on some complicated systems involving software, I have strived towards using a set of practices that are best-in-class. Much to my delight, I found an amazingly well-researched paper on best practices in software development independent of software language. The team of authors have annotated each of the ten best practices in their paper with supportive guidelines.

  • Write programs for people, not computers.

A program should not require its readers to hold more than a handful of facts in memory at once.
Names should be consistent, distinctive, and meaningful.
Code style and formatting should be consistent.
All aspects of software development should be broken down into tasks roughly an hour long.

  • Automate repetitive tasks.

Rely on the computer to repeat tasks.
Save recent commands in a file for re-use.
Use a build tool to automate their scientific workflows.

  • Use the computer to record history.

Software tools should be used to track computational work automatically.

  • Make incremental changes.

Work in small steps with frequent feedback and course correction.

  • Use version control.

Use a version control system.
Everything that has been created manually should be put in version control.

  • Don’t repeat yourself (or others).

Every piece of data must have a single authoritative representation in the system.
Code should be modularized rather than copied and pasted.
Re-use code instead of rewriting it.

  • Plan for mistakes.

Add assertions to programs to check their operation.
Use an off-the-shelf unit testing library.
Turn bugs into test cases.
Use a symbolic debugger.

  • Optimize software only after it works correctly.

Use a profiler to identify bottlenecks.
Write code in the highest-level language possible.

  • Document the design and purpose of code rather than its mechanics.

Document interfaces and reasons, not implementations.
Refactor code instead of explaining how it works.
Embed the documentation for a piece of software in that software.

  • Collaborate.

Use code review and pair programming when bringing someone new up to speed and when tackling particularly tricky design, coding, and debugging problems.
Use an issue tracking tool.