Toolbench pattern

From triplescripts.org wiki

The toolbench pattern, workbench pattern, or shell pattern is a way to expand the reach of a triple script.

If unhappy with a triple script, anyone has the opportunity to change it, but if they are unhappy with the restrictions of triple scripts in general (see invariants), they are encouraged to create their own purpose-built workbench for the script to run on (or, to mix metaphors, "inside").

For example, triple scripts can't make network requests, so they're less capable in that regard than even an ordinary web page. However, there's nothing stopping anyone from creating a small app that includes its own triple script runtime and which takes as input a given triple script and then cooperatively drives it in a way that the author considers to be more "ergonomic". Triple scripts' predictable module semantics and the object-capability model make this especially feasible. This pattern of creating a "shell" around the triple script allows for the existence of powerful toolbenches, where such things as networkability or arbitrary filesystem access belongs to the wrapping app itself and need not "taint" the triple script.

Consider UNIX. If something bothers you about curl, you have the option of patching it to do what you want. But suppose there were an impedance mismatch that you feel when you use curl—something unintuitive or undesirable about its UI, but curl itself is doing the job it's supposed to do and following ordinary conventions. Consider whether the problem you're feeling is one of ergonomics—might it be possible to make special-purpose changes to your shell that would resolve the issue, without having to patch curl itself?

Or more concretely, consider two tools: a static site generator in contrast to release automation tooling. The job of a static site generator—or any other type of compiler—is fairly straightforward. A static site generator, like Jekyll for example, does a batch read of a bunch of files and then spits out some files in the processed form. This a task that triple scripts are reasonably well-suited to handle. The next step that a person who has just used a static site generator next wants to accomplish, though, is usually to upload those files to a web host. This is not something that triple scripts are well-suited for, and there will never be a way to patch a given static site generator implemented as a triple script to get it to be able to sync the files for the user. Nor will it ever be possible to use the triple script to spin up a web server on localhost allowing the user to preview the generator's output in his or her browser, unlike the way that it's possible with jekyll serve.

On the other hand, it's entirely doable to implement a purpose-built shell around a given triple script. In our static site generator example, the shell might host a runtime for a given triple script and permit the user to interact with the triple script directly. Upon completion, when the static site generator has finished its job, the shell can then use its own privileges to dump the resulting pages onto a web host.

Similarly, a typical setup for release automation tooling includes syncing the resulting build artifacts to a server for wide release. A triple script in itself can handle the build, but the final act of uploading will have to be deferred—either to the user, or whatever agent the user assigns to handle the final artifacts that the script produces.

External links[edit]

See also[edit]

Cookies help us deliver our services. By using our services, you agree to our use of cookies.