Learn to Code by Making Art
Learn programming while your create computer art by copying code from my free guide.
https://splashofcode.com

Clump Programming

Clump Programming is a simple process I designed in order to organize my files more efficiently for programming.

Rational

I've been using CVS for about 10 years. This works well for me, but in some situations there is resistance to CVS either because of it's inconvenience or because of technology limitations. It's also not terribly efficient for an individual developer. As a result, I'm looking for a new process.

Advantages

  • Allows you to organize files into clumps that help you remember the specific files you edited for a particular project, especially when you are editing a few files that are a small part of a larger project or system.
  • Creates backup copies of files at significant points in the process.
  • Allows you to see which files have changed since the last “snapshot”, including those edited by others.
  • Does not effect other developers in any way. In fact, they will have no idea you are using clumps.
  • The same files can be organized into multiple clumps. Useful when there is overlap in several small projects that use some of the same core files. Also useful when reusing libraries across multiple projects.
  • Usable on files via FTP, SSH, a network share, or even a mixture of files from several different sources.
  • Files inside a clump are not editor specific. They can be edited with any editor. This is an advantage over projects in some editors, which are editor specific.
  • Changes are made in real-time to the main file.

Disadvantages

  • Extra time is required to organize a clump and keep it organized.
  • You must remember to snapshot files, which is similar to a commit on a typical version control system.
  • Changes are made in real-time to the main file.
  • Under MS Windows special software is required in order to create symbolic links.

Creating Clumps

A clump is simply a directory, which you create to organize files for a particular project. The files inside the clump, however, are symbolic links to the actual files, which are located elsewhere (on an FTP server or network share, for example).

A clump should never contain original files. If you are working on a file on your local machine, and you want it organized in the clump, put it elsewhere and link to the original in the clump. This way, your clump is mostly unimportant (backup) files.

Taking a Snapshot

A snapshot is simply a copy of a particular file at some important point in time. The copy is named the same as the file followed by two underscore characters and a snapshot number. The file is stored in a .cbk (clump backup) directory.

Suppose I have a file called “example.txt”. This file was created by another developer and I'm about to edit it. First, I take a snapshot of the file before I edit it. Then I make my changes and take another snapshot when I'm finished. There are now three files, as listed below.

example.txt
.cbk/example.txt__0001
.cbk/example.txt__0002

The original file, example.txt, is still a symbolic link to a file elsewhere. The snapshots, however, are copies of the file on my local file system. They are important only to me (in my case).

If you had a team of developers committed to this system, you could also create the snapshots in the original path, where everyone would have access to them.

Snapshot Information

When you take a snapshot, you should also create a snap file that includes information about what each snapshot is. The snap file is just a text file with a short description of each snapshot. The snap file is named the same as the file with “__snap” added to the end and it is stored in the .cbk directory.

.cbk/example.txt__snap

The contents of the snap file might look something like the following.

===== 0001 =====

Did this or that or the other.


===== 0002 =====

Added 5 more example cases.

I prefer my snap files to be in a wiki-like syntax, so I can easily drop them into my wiki if I need to.

Snapshot Tool

To make snapshots easy, I wrote a command line tool that creates these snapshots automatically.

snap.php

Installation Instructions

  • Create a new directory for this program.
mkdir /opt/snap/
  • Copy the snap.php file there.
cp snap.php /opt/snap/
  • Create a symbolic link in /usr/bin.
ln -s /opt/snap/snap.php /usr/bin/snap
  • Make the file executable
chmod +x /usr/bin/snap

Taking a Snapshot

Now, taking a snapshot of a file is easy. Just run the following command from the same directory as the file.

snap <filename>
Learn to Code by Making Art
Learn programming while your create computer art by copying code from my free guide.
https://splashofcode.com
comments powered by Disqus
clump_programming.txt · Last modified: 2008/11/20 15:16 (external edit)