À la bonne Sainte-Force

Tools

Tags

RAIIScript

4 April 2012

Dear friend,

Because I'm very busy these days, I felt the urge to lose some time doing something that would save me some time (another day). I had a bunch of situations like this :

  • there's some kind of resource that has to be created starting from a certain moment (it can be a web server, or a directory, or a printer, or whatever, use your imagination);
  • this resource must die at another moment;
  • I happily access the resource between its birth and its death;
  • forgetting to shut down the resource results in the total annihilation of the known universe.

Using a terminal makes it easy to enter the birth and death commands, but these terminal windows are filling my screen, they're all the same, and typing commands everytime is neither practical, nor sexy. What about some big icons living in the dock ? A resource could be embodied as a (rather inert) application, allowing us to act upon them with more Sainte-Force and less worries. We could give those resources an opportunity to be part of a better computing experience, where every desktop would look like this one.

The dream has come true today :

This application is very simple : when it starts, it executes a script called start, and when you quit it, it executes another script called stop, as well as it terminates the start script if it is still running.

Think of it as an empty shell where you can put what you want to meet your requirements. You can use it to control a web server, for instance. The name RAIIScript comes from a classic C++ programming idiom, RAII, which leverages the constructor/destructor symmetry to guarantee the control of a resource by an object during its lifetime. Applications also afford a symmetry that can easily be handled for some tasks with RAIIScript.

One way to use this application is to duplicate it, and then customize the duplicate to fit a particular need. First, rename the application and launch it. Second, through the application menu, you can go to the Resources folder (where both start and stop lie) or open the Info.plist file. Modify what you want until it feels right.

That's all. You're one step closer to the perfect medieval-looking computer-as-a-tool.

Looking forward to hearing from you,
Hubert Sainte-Force