Monday, July 10, 2006

Powerful commands should have a verbose syntax for the novice and a terse syntax for the expert.

Case in point, Perforce's overlay mappings. Compare:

//DEVELOPERS/tlh/codestream_one/... //workspace/...
+//MAINLINE/... //workspace

vs

//MAINLINE/... //workspace
+//DEVELOPERS/tlh/codestream_one/... //workspace/...

The desired end result is "Prepare a workspace that would look as if I had merged all my changes into the mainline."

The two example syntaxes might be read as "use my files, then add the mainline" and "use the mainline, then substitute my files."

It turns out that Perforce's engineers like the second syntax. Using the first syntax gets you "use all the files from the mainline, and any brand new files from my development set, ignoring any changes I may have made to the mainline files." Which is a bummer.