You should have a scratch code repo

Control is for Beginners. Iteration is truly the mother of invention.

I have a directory called “scratch” in my main code directory where I can easily add a new file to, whip up a new program and test it out. It’s a private git repo that I can backup to github so that I don’t lose any of my work.

~/code/scratch (master) $ ls -l | wc -l
31

I just used it again today, and as of this writing has 31 files in it.

Some of the benefits of a “scratch” repo are that I don’t have to worry about the overhead of creating a new directory, initializing git, or worry about code structure (like should I put this file in a bin or lib directory?). This means that I can start coding right away in a new .rb (or whatever your language of choice is) file and just get the minimal thing working. Having a scratch repo also frees you from stress of code quality because you know no one else will see it. It’s just for you to hack on things and get them working as quickly as possible.

Once the little scratch app has proven that it works, then you can take the time to extract it out into its own project or add it to an existing project, but if you didn’t start out this way you may have never gotten it to work in the first place.

If you don’t have a scratch repro yet, you should.