Application development: Give it a REST

In the era of “doing more with less,” you may need to implement manufacturing applications that consist of a database and a set of user interface screens and reports. A software architecture style for these environments is highly recommended and widely used. It is called REST, short for Representational State Transfer, and describes a collection of network architecture principles for building scaleable and robust distributed applications.

By Dennis Brandl February 1, 2009

In the era of “doing more with less,” you may need to implement manufacturing applications that consist of a database and a set of user interface screens and reports. There is a software architecture style for these environments that is both highly recommended and widely used. It is called REST, short for Representational State Transfer, and describes a collection of network architecture principles for building scaleable and robust distributed applications.

REST is an alternative to the older Remote Procedure Call (RPC) model for distributed applications. It is also an alternative to the SOAP (Simple Object Access Protocol) model when a lightweight and easy to maintain interface can be used. The REST model was defined in the 2000 doctoral dissertation of Roy Fielding ( https://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm ), one of the principle authors of the HTTP specification, and has become the common model used for new Web based applications.

Powerful applications fast

The REST model lets you rapidly build powerful applications. It is taught in modern college programming classes where a typical one-week project may be the re-creation of a FaceBook or Amazon-like application using a MySQL database and a CGI (Common Gateway Interface) compatible scripting language. The simplicity of the model makes it a good choice for lightweight manufacturing applications, such as equipment and personnel tracking, maintenance logs, time and material use logs, order tracking, and test results tracking.

The REST model is based on the concept of uniquely identifiable resources, usually identified through a URI. For example, a URI in a manufacturing application may identify a specific piece of equipment like this: https://example.com/equipment/ProductionLine12/WidgetCounter.php . There is also a uniform interface for operations on the resource and a standard method for exchanging information associated with the operations. The most commonly implemented operations are the HTTP POST and GET methods. HTML links provide a GET method; HTML forms provide the GET and POST methods, allowing the user interface to be based on standard Web browsers. Specific commands to the resource are passed as arguments on the URI using standard HTTP syntax.

This method of communications means that intermediate proxies, caches, gateways or firewalls are not visible to either the Web browser or the application, significantly simplifying the application code. The application code resides on the Web server and is not visible to the client, so it is relatively secure and requires no client-side software installation.

The preferred application language is a CGI compatible Web-centric scripting language, such as PHP ( www.php.net ), Python ( www.python.org ), Perl ( www.perl.org ), or Ruby ( www.ruby-lang.org ). CGI is the standard for interfacing external applications with Web servers so that the application script is run whenever a page request (GET or POST) to the URI is made. All of the scripting languages have built in methods to obtain the arguments from the URI. The scripts then execute the requested function, often using information from an SQL database, and return a new Web page with new information and new links for further commands.

The hardest part of this method is usually the generation of the new Web page, which is why Web-centric scripting languages are used. These languages are designed to quickly parse the URI arguments, access databases, build DOM (Document Object Model) representations, and generate Web pages.

You can solve a wide range of manufacturing application problems without resorting to expensive new hardware and software licenses, at the cost of a small amount of development time. The REST application model, recycled hardware, UBUNTU operating system, MySQL database, and PHP, Python or Perl software provide the low cost and high productivity toolkit for “doing more with less.”

Author Information
Dennis Brandl is president of BR&L Consulting in Cary, NC, dbrandl@brlconsulting.com .


Related Resources