Case study: Turning custom scripts into reusable components

Case study: Turning custom scripts into reusable components

An organization had accumulated a large number of legacy scripts and programs over the years. They were written in different languages and spent their days sitting on various servers and desktops, produced over time by everyone ranging from the power user in accounting, to a helpful sysadmin all the way to long-departed developers in IT.

These scripts and programs provided many different capabilities. Someone ran a small web server on their desktop, providing a view into a small custom data base of sales prospects. A former sysadmin had written a script, which was able to look into the manufacturing database and produce a list of parts that would soon be out of stock. Very useful, except that nobody in manufacturing had access to the Unix machine on which it resided or knew how to start it from the command line. Examples like this existed throughout the entire enterprise.

A lot of useful organizational knowledge had accumulated in those scripts and custom code. But it was felt that a lot of effort and knowledge was locked away in a mostly inaccessible and poorly documented manner.

RESTx to the rescue: Just like a custom script or program takes some free form input (a string from the command line, for example) and produces some more or less free form output, RESTx components can do just that as well. RESTx does not have high demands to the particular structure or organization of the component code, thus allowing easy conversion of existing code into components. In addition, RESTx's multi-language nature allows more of the existing custom code to be easily converted to RESTx components.

The IT department took the custom scripts it could find and ported them to RESTx components. Because of RESTx's multi-language support, this task was easy. For example, the sysadmins script for access into the manufacturing DB was written in Python anyway. Most of the script's code could just be copied and pasted into a RESTx container. After creating a resource based on this component, it was suddenly very easy to provide access to this script: Users merely had to click on a URI.

Finally, RESTx provides a framework by which the code's configuration can be specified separately (during resource creation time), rather than hard coded in the code or fixed config files on servers or desktops to which only few have access. Therefore, the custom code suddenly becomes more flexible and usable in different contexts: New configurations can be provided easily to tweak the behavior of the component.

In the example of the manufacturing DB component, it turned out that just with a tweak of a few parameters, the component could also produce other interesting information, such as a list of overstocked items. Creating a particular resource for this was easy with RESTx and required only a form to be filled out in a web browser.

RESTx also provides an automatic listing of the available resources, complete with documentation. Therefore, the organization did not have to worry about maintaining a separate resource registry.