what makes a good script?

A good script is one that anticipates and responds to user needs now and in the future with minimal maintenance. Making scripts "general" allows it to respond to anticipate user needs by responding to situations found in the data and its context.

Consider an example. A client recently wanted to make a variety of help files available to the user. Thing is, the files would be revised, replaced, and/or expanded regularly. Hard-coding a list of files into the script would mean that every time these help files were updated or exchanged, the script would need to be edited. This is not productive use of scripting resources because it adds complexity unnecessarily.

We designed the script to read a list of available files from a folder on the corporate network. The script then takes this list and creates a panel where the files are listed in the desired order. When new files are added, the script will automatically create an expanded list of available help files. If any are removed, the script will no longer list those files the next time it is run. This is all done automatically, no changes are required whatsoever to the script! Below, you can download a small script that illustrates how this works.

There was one additional need: the client wanted the panel to detail a revision date for each file. So, we added some delimiter characters to the file name so that the date and button text could be easily specified in the file.

Help Files menu
Help files are recorded in a folder on the corporate network. The order the files appears in the help menu is determined by the first two characters. Delimieters ("-ds-, "-de-", "-ts-", "-te-") indicate the revision date and the text to appear on the button of the script. This panel of help files was created from the folder of files on the left. Clicking on these buttons opens the corresponding PDF file.

Now, try it yourself! Download the script (JMP 7.01 required) and a set of help files (Windows, Macintosh). Run the script as it is and see watch the files show up as buttons in the menu. Next, remove some files and run the script again and not how the panel responds. Finally, add some files of your own and watch the panel expand when you next run the script.

This script responds to its context and by doing so, anticipates user needs and will continue to do so without maintenance.

We have created scripts that anticipate user needs in all sorts of ways. Sometimes it's a matter of what day it is, others it what data is selected for analysis or who is conducting the analysis. Frequently it involves responding to the insights found in the analysis itself. If all is well, the script does one thing, if all is not well, it triggers the appropriate action for the user.

Good scripts lift productivity and eliminate errors now and in the future.

 
© 2004-2008 Predictum Inc. - #506, 592 Sheppard Avenue West, Toronto, ON M3H 6A7 Canada
Tel: (416) 398 8900 info@predictum.com