Archive for the ‘software engineering’ Category

Happy birthday, Ada Lovelace

12 December 2012 Leave a comment

It’s a bit late here down under. But I’m going to say it anyway: Happy birthday, Ada Lovelace. Here’s a nice synopsis about the first computer programmer.

Best practices for scientific computing

11 December 2012 Leave a comment

This paper is a must read for scientists who write software as part of their research, but are not themselves software engineers. I’m not going to repeat the paper, but list some major points that should be kept in mind when developing scientific software alongside research.

  • Write programs for humans, not computers.
  • Automate as much as possible, especially repetitive tasks.
  • Use the computer to record history.
  • Make incremental changes, with constant revision and evolution.
  • Use a version control tool.
  • Don’t repeat yourself or others. It’s ironic that I’m repeating this message from the paper.
  • Plan for mistakes in your software or its output.
  • Optimize your software after you have it working correctly.
  • Document the design and purpose of your software, not its mechanics.
  • Collaborate with others.

COMP20005 how to time a program

29 August 2012 1 comment

Some students have asked me how to time the running of a program. Essentially, the problem is how do we know the amount of time that a program takes to run. In C, you can use functions from the header file time.h to time your program. The program below shows how to do a simple timing of a program.

#include <stdio.h> 
#include <time.h>

int main(int argc, char **argv) { 
  char name; 
  double howlong; 
  time_t start, end; 

  start = time(NULL); 
  printf("Enter your name: "); 
  scanf("%s", &name); 
  end = time(NULL); 
  howlong = difftime(end, start); 
  printf("You took %.3lf seconds, %s\n", howlong, &name); 

  return 0; 
Categories: COMP20005, programming