InfoWorld review: Tools for rapid Web development

With WYSIWYG prototyping environments and preconfigured graphical components, rapid Web development tools can help you build applications faster -- but with less flexibility

1 2 3 4 5 6 7 Page 6
Page 6 of 7

MLState OPA 2.0 Beta
MLState's OPA is both a language and a development paradigm. The acronym OPA stands for One Pot Application, the implication being that everything you need to create a Web application is in a single place. With OPA, you don't need to create HTML and JavaScript pages on the client side, and PHP (or whatever server-side language you choose) and SQL on the server side. OPA serves it up all in one spot.

Actually, this claim is only partly true. Although there are no separate client and server modules in an OPA application, you have to include HTML and JavaScript code. It's sort of like building a Java servlet: You aren't completely insulated from other technologies. OPA won't select which JavaScript calls to make where; you have to express that in the code explicitly.

One thing is true: With OPA, you don't have to deal with a separate Web application server. When you compile an OPA application, it creates a single executable that contains the Web server, the business logic of the application itself, and a database runtime.

As a language, OPA is a statically and strongly typed language. In fact, the current version is so strongly typed, there are different mathematical operators for integer and floating point numbers. Documentation promises that future releases will allow overloaded operators in this case.

OPA recognizes simple data types -- integers, floats, and strings --  as well as more complex structured types such as Lists, Maps, Sets, and Iterators. OPA supports a "record" datatype, which is analogous to the C-language struct. It also has the notion of "sum," which is a way of handling variants by informing the compiler that a given variable might hold one of several data types and to execute code based on its current type.

OPA has special syntax elements for manipulating an application's HTML and JavaScript. For example, you can define an action -- code that executes in response to a user event (say, a button click). Also, you can identify elements in OPA source that are bound to elements in the HTML page. Putting those two together, you can have some OPA code like this:

action() = [ #result <- jQuery.getText(#("text")) ]

And couple it with HTML like this:

<textarea id="text" rows={1} cols={10}></textarea>

<p onclick={action()}>Click here</p>

<p id="result"></p>

The above allows the user to enter text into a text area, hit the "Click here" label, and see the entered text poured into the page element marked by id="result". Of course, the HTML shown in the latter snippet would be emitted by another OPA command.

OPA can use some AJAX libraries out of the box. (The preceding example uses jQuery.) You cannot yet, however, import new AJAX libraries into the OPA environment. The OPA engineers explained that they are working on a safe way to integrate other AJAX libraries.

OPA functions can be embedded in HTML in much the same way one might embed Java in a JSP. For example, the following code produces a simple Web application that displays the current time:

server = one_page_server("Time", -> <>The current time is

{Time.now()}</>)

The function one_page_server() is a sort of main() function that defines the runtime entry point to application plus Web server whose title is Time. Note the embedded function call to the OPA-provided Time.now().

MLState OPA 2.0 Beta
Just a few lines of OPA code are enough to create a primitive, but functioning, wiki site. The code on the right compiles to produce the wiki open on the left.

One of OPA's more important functions is parser(), which works something like a switch() (or select) statement. When passed the URI (handed to the server by the Web browser), the parser function moves the URI through a series of regular expressions, which you can line up, one after another. Each regular expression can be mapped to a function, such that if a given expression returns a match, the associated function is executed. This permits a single OPA executable to serve up multiple Web pages.

OPA's fundamental idea is sound: OPA's blending the stew of Web development -- server side, client side, and persistent storage -- into a single executable is enticing. Also, it's refreshing to not have to wrestle with Web servers, making sure that all the various configuration variables are set properly, shared libraries are where they must be, subdirectories in their proper place and set with their proper permissions. All those niggling details are dealt with by OPA.

But for anyone versed in the likes of VB.Net, C#, or even Ruby, Python, PHP, or JavaScript, the language of OPA will take some time. Also missing is complete documentation. At the time of this writing, there was no API documentation, and the language documentation stopped at the "Polymorphism" section. This implies that OPA supports object-oriented features, but it's difficult to know without documentation available.

1 2 3 4 5 6 7 Page 6
Page 6 of 7