Keeping better track of past programming code?
June 4, 2008 9:56 PM   Subscribe

How can I better organize my different bits of programming code for reference and reuse?

Lately I have been using python to control API of various software using pythonwin IDE. To keep myself organized I have been essentially naming folders with long descriptive titles (and also naming them in successive alphabetical order at the begining of the name to keep a reference to how long ago i created this folder), and then inside I have a descriptive name for the actual python file in question.

This is getting out of hand, as it usually takes me far too long to find old snipplets of code that are similar or identical to the one im currently trying to write. And obviously many times i give up finding old code and just code from scratch.

I have no problem with pythonwin (I guess the IDE or even the language isnt even that relevant to this question), but I would like to have software that can organize (tag/preview the code/sort by various criteria such as date made/date last accessed..etc etc) my old code, so that once I find what I am looking for i can just click on the link to the code and it opens up in some other IDE such as pythonwin.

I am using python in a windows environment and would prefer free software (who wouldn't?:P) I have searched a fair bit and can't seem to find anything.

Thanks Metafilter!
posted by figTree to Computers & Internet (7 answers total) 3 users marked this as a favorite
not free, but excellent: personal knowbase
posted by drjimmy11 at 10:40 PM on June 4, 2008

Lots of text files, well-written comments with tags, and grep. There are plenty of fancy options, but when it comes down to it, plaintext files and the classic unix text utils work out to make life far simpler. A few choice perl (or python, I suppose) scripts could automate a lot of the searching and tagging.
posted by devilsbrigade at 12:16 AM on June 5, 2008 [1 favorite]

I'd say a wiki or evernote or google notebook
posted by nalf at 1:34 AM on June 5, 2008

Taking a slightly different approach, tidy your code fragments up into higher-level packages, and put them in a source code repository (eg SVN). Use SVN externals to import your "helper" code into each new project when you start it. That way, improvements to your helper code get automatically back-ported into your older projects.
posted by Leon at 2:32 AM on June 5, 2008 [4 favorites]

Seconding source control. I have been switching from subversion to git, and I love! how easy importing a project is:
$ git init
Initialized empty Git repository in .git/
$ git add file*
$ git status
# perfectly sensible status message
$ git commit -m"added first three files"
$ git log
commit 4fa331e0bbd8987ab88fb0c340f64ebcd6c196af
Author: fantabulous timewaster
Date: Thu Jun 5 14:02:57 2008 -0400
added first three files
I would advise source control then tidying, rather than the other way around.
posted by fantabulous timewaster at 11:08 AM on June 5, 2008 [1 favorite]

for source control on windows: svn + tortoisesvn. spend some time getting your head around the idea of source control before you dive in. The Subversion Book is pretty good too. I haven't tried Git but have heard it's the latest thing...might be a good choice if you don't want to have a centralized server, but I've run subversion just fine locally for a while before setting up a server I could access from elsewhere.
posted by jacobsee at 12:35 PM on June 5, 2008 [1 favorite]

What about using one of the many desktop search programs (e.g. Google and Yahoo) to index your source files? If you're willing to do some sensible commenting, this should do the trick.
posted by mausburger at 2:05 PM on June 5, 2008

« Older Oh Brother, Where Art Thou?   |   Frederick, Maryland: amuse me. Newer »
This thread is closed to new comments.