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.
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.
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.
Software tools should be used to track computational work automatically.
Work in small steps with frequent feedback and course correction.
Use a version control system.
Everything that has been created manually should be put in version control.
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.
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.
Use a profiler to identify bottlenecks.
Write code in the highest-level language possible.
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.
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.