- Microsoft Windows chief decries standards grandstanding
- The 5 best, and 5 worst, features of Google Chrome OS
- Federal government using PS3 to crack pedophile passwords
- 10G Ethernet cheat sheet
- Top 10 free Windows tools for IT pros, at a glance
In last week's column (which was online only) I continued my exploration of a cool programming system called Runtime Revolution, focusing on the tool's object-oriented, event-driven architecture. This week we'll look at the product's English-like language, a style referred to as "candygrammar" by some cynics.
Here's a thing about Revolution scripting language; it is, indeed, kind of "wordy." Want to put a rounded-up value into a field shown in the user interface?
put round(22.3) into field "Number"
You can also use the "the" form when using a function such as date that takes no or just one parameter. Thus the following lines are equivalent:
put date() into field "field1"
put the date into field "field1"
You can also "get" values from functions or variables. This command, along with a number of others, such as such as convert (which reformats dates and times), read from file, and ask and answer (which both display dialog boxes), stores the result in a special variable called "it". For example:
on mouseUp
answer "Go where?" with "Backward" or "Forward"
if it is "Backward" then go back
else go next
end mouseUp
Revolution has some interesting language features of which "chunking" is one of the most powerful. Chunking provides an easily specified and understandable way of breaking text into sections. Revolution's chunking lets you extract or edit a character, word, line, item or tokens.
The first three chunk types are obvious. Items are defined by being delimited by any character you specify, while token chunks are delimited by any of a range of punctuation marks (these are useful for parsing things like scripts and URLs). Here's an example of extracting a word chunk consisting of the first three words from a user interface text field:
put word 1 to 3 of field "text" into myVariable
Revolution also has some features that make designing user interfaces remarkably easy. One of these is the geometry manager, which specifies how objects should be scaled and positioned when a user resizes a window. This is a really clever feature because it provides a practical methodology for maintaining the user experience at varying screen resolutions.
Revolution is extensible through libraries and, for example, the system includes an XML library for reading, editing and creating XML data. This library is OK but not the best choice from a functionality and documentation viewpoint (it is one of the few areas where Revolution is weak on explanation).
There are two ways to overcome these problems: The first is to use the excellent STS XML Library from Sons of Thunder Software. The second is to use the chunking features of Revolution scripting -- somewhat easier than XML libraries but less flexible.
While Revolution is on the wordy side it is also quite easy to follow with little of the obscure syntactical "techiness" that makes many other modern languages hard to learn. Revolution also lends itself admirably to rapid iterative design processes such as user experience engineering.
Comment