8

I frequently code numerous experiments to test various algorithms, libraries, or hardware. All code, dependencies, and output of these experiments need to be annotated and saved, so that I can return to them later. Are there good common approaches to this problem? What do you do with your experiments after running them?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Don Reba
  • 13,814
  • 3
  • 48
  • 61
  • 7
    store them in a version control system? –  Aug 24 '09 at 13:29
  • 1
    I like git for this kind of stuff. All the history with you all the time, easy to back up. – Mike Mazur Aug 24 '09 at 13:32
  • I've used Subversion before (in one of the posts below) however if you can try and use GIT its much better. (I'm yet to use it, but want to soon) – Audioillity Aug 24 '09 at 13:33
  • This is only a small step away from saying "store them in a file system" — very vague. – Don Reba Aug 24 '09 at 13:36
  • 2
    If you've never used git, how do you know it is better? I can't believe the fanboy ardour that a version control systems seems to inspire in some people. –  Aug 24 '09 at 13:36
  • @Neil: I wouldn't call that fanboy ardour, but just hearsay parroting – Vinko Vrsalovic Aug 24 '09 at 13:41
  • I trap them inside a silver box with yellow and black striping, which I can carefully place inside a large safe, that I have crafted a special entry-box in, kind of like a mail box. After dropping the experiments inside, I press a button to immediately destroy them. – Noon Silk Aug 26 '09 at 03:28
  • If they aren't in version control somewhere, you're doing something wrong. Period. – Instance Hunter Aug 26 '09 at 03:38

5 Answers5

5

When I do these, they are usually project specific, so they go in a subdirectory of the project (usually named "Investigations" in my case). This gets checked into the version control system with everything else.

Results (where appropriate) go into the same subdirectory of "Investigations" as the code used to produce the results.

DrAl
  • 70,428
  • 10
  • 106
  • 108
  • @S.Lott: "Spikes": I like it! – DrAl Aug 24 '09 at 13:43
  • This is what I do, as well. Except, experiments branch and back up much more than production code, which tends to lead to a mess in the version control system. Searching and checking out previous versions from SVN is quite inconvenient. – Don Reba Aug 24 '09 at 13:53
  • 1
    @Don: Thankfully, it's not too bad in bazaar (one of the reasons I changed my repository from subversion to bazaar). – DrAl Aug 24 '09 at 14:15
5

At a prior job we had a project in SVN called Area51 where people would write test code. The rules were

  1. create a package namespace
  2. start via a public static void main
  3. add comments via javadocs
  4. leave the project in a compilable state
  5. the project can never be a dependancy of other code

On a three person team this worked out ok. We could put "what if" code there to share and it was easy to run it via ide or command line

sal
  • 23,373
  • 15
  • 66
  • 85
3

http://subversion.tigris.org/

Galwegian
  • 41,475
  • 16
  • 112
  • 158
2

I just have a folder which I call OneOffCode

This is a folder of just code I have written either learning a new technology trying to prove a concept etc. . . This is non production code.

I usually back it up to a jump drive and move it with me from Job to job, or computer to computer.

David Basarab
  • 72,212
  • 42
  • 129
  • 156
2

I'm usually switching between C# and C++. So, I have a Test console application for C# and C++ in a "Sandbox" location, under source control. The console applications are both setup the same way where there is a Main which calls the test that I'm trying at that time. When I'm done I keep the old methods and comments and just clear out the Main when the next test comes about.

I don't know if it is the best, but after it is setup then it is pretty quick to get in, get the answers, get out and have it all saved for the next time.

Loren C Fortner
  • 4,217
  • 3
  • 18
  • 12