Software Carpentry's Best Practices
Written by Mike James   
Wednesday, 08 January 2014

Software Carpentry's aim is to make scientists better equipped to work with software just as if it was any other lab apparatus. Now we have its take on "Best Practices" and it is a lesson to us all scientist or not. 

softcarpicon

 

Software Carpentry teaches scientists to work with software in a more logical and organized way than is typical, In the old days lab equipment was mostly hardware and it was an important component of any experiment. It was put on show and scrutinized by other scientists. Not so with most of the software and even the data that is involved in most modern experiments. Scientists tend to take a casual approach to programming because it is so much easier than hardware. Of course well all know that it is only easier when you first start. As you slowly tangle yourself up in logical knots it gets harder and harder to work with. As a result lots of scientists tend to hide their code way and the same with raw data.

The point is that that the scenario just outlined not only applies to scientists but to just about anyone using or creating software in anything other than completely trivial ways. 

In a recently published paper Software Carpentry outlines what it considers to be "best practice" and it is a document that has a relevance well beyond the strictly scientific.

It presents 24 specific things scientists, or programmers in general, can do to get more done in less time with less pain:

  1. Write programs for people, not computers.
    1. A program should not require its readers to hold more than a handful of facts in memory at once.
    2. Make names consistent, distinctive, and meaningful.
    3. Make code style and formatting consistent.
  2. Let the computer do the work.
    1. Make the computer repeat tasks.
    2. Save recent commands in a file for re-use.
    3. Use a build tool to automate workflows.
  3. Make incremental changes.
    1. Work in small steps with frequent feedback and course correction.
    2. Use a version control system.
    3. Put everything that has been created manually in version control.
  4. Don't repeat yourself (or others).
    1. Every piece of data must have a single authoritative representation in the system.
    2. Modularize code rather than copying and pasting.
    3. Re-use code instead of rewriting it.
  5. Plan for mistakes.
    1. Add assertions to programs to check their operation.
    2. Use an off-the-shelf unit testing library.
    3. Turn bugs into test cases.
    4. Use a symbolic debugger.
  6. Optimize software only after it works correctly.
    1. Use a profiler to identify bottlenecks.
    2. Write code in the highest-level language possible.
  7. Document design and purpose, not mechanics.
    1. Document interfaces and reasons, not implementations.
    2. Refactor code in preference to explaining how it works.
    3. Embed the documentation for a piece of software in that software.
  8. Collaborate.
    1. Use pre-merge code reviews.
    2. Use pair programming when bringing someone new up to speed and when tackling particularly tricky problems.
    3. Use an issue tracking tool.

For a more detailed explanation of each one see the paper which is free to download.


softcarpiconsquare

More Information

Best Practices for Scientific Computing

Software Carpentry

Related Articles

Mozilla ScienceLab       

Software Carpentry - Learn To Program       

 

To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, FacebookGoogle+ or Linkedin,  or sign up for our weekly newsletter.

 

espbook

 

Comments




or email your comment to: comments@i-programmer.info

 

Banner


Apache Releases Tomcat 11
07/11/2024

Apache has announced the release of Tomcat 11, as well as marking the 25th anniversary of the first commit to the Apache Tomcat source code repository since becoming an ASF project.



Edera Releases Open Source Container Benchmark And Scanner
07/11/2024

Edera has released Am I Isolated, an open source container security benchmark that probes users runtime environments and tests for container isolation.


More News

Last Updated ( Wednesday, 08 January 2014 )