Opa - a unified approach to web programming
Written by Ian Elliot   
Sunday, 28 August 2011

Opa is a new open source language that lets you write an app and compile it to a JavaScript application on the client, complete with server-side support including a database.

New languages are commonplace and for a language to deserve more than academic attention, or just the adulation of its enthusiasts, it has to make a breakthrough to the wider programming community. Opa is a new open source language with design objectives we can all appreciate.

 

OPAlogo

 

At the moment web development is a mess of technologies that don't quite fit together and yet we are so familiar with the way things are we seem to not notice. To create a web app you have to code in HTML, a server side language such as PHP, style the page with CSS, write client side code with JavaScript and hope that it all works on the browser. The idea of Opa is that you write an app in a single language and compile it to a JavaScript application on the client complete with server side support including a database. What this means is that you write your app in Opa and leave the compiler to sort out the technologies used.

A "hello world" in Opa is just

server = one_page_server("Hello", 
-> <>Hello, web!</>)

Of course this isn't very informative because if you assume that there is a suitable procedure for the task programs in any language come do to a single procedure call. When you look at Opa more closely it looks like a cross between HTML and a functional language that occasionally reminds you of other languages. The HTML can have variable values inserted into it to make it dynamically update. It also makes heavy use of the DOM and CSS. So to make use of Opa you have to know some HTML, CSS and the DOM anyway.

The web server part of the system is represented by the server construct which can be used to setup multipage websites. However you still have to parse a URL to determine the dispatch sequence. Of course the servers are implemented as parallel operations and the system can scale by using additional cores or it can be run on a distributed "cloud" like system without any modification. It is also claimed that the system is more secure because the custom web server/database provides a smaller attack surface.

 

opademo

 

Overall Opa has some attractive ideas. My personal opinion is that it repeats the mistakes of other attempts to create a unified web development system in that it doesn't abstract far enough way from the underlying technologies. Imagine if I offered you a new high level language that allowed the machine code to poke through? Seeing HTML all over the code is just as bad. This is not to say that there is an easy or obvious way to get rid of HTML and there are advantages in using a technology that is already well accepted. There are also aspects of the language that are sufficiently different to cause the average programmer some trouble - it isn't object oriented and it derives from a functional language which gives it a feel that is going to be alien to most. Its approach to distributed sessions is good but Node.js provides a similar and arguably easier to understand approach to managing asynchronous web operations.

If you are interested in Opa it might be worth having a look now because there is a developer challenge running at the moment. All you have to do is writing something in Opa and you can win a MacBook Air, an iPad 2 or a Nintendo 3DS. You have until October 17, 2011 to enter. For more information see the main Opa website where you can also download the code and binaries for Linux and Mac Os X.

 

OPAlogo

More Information

Opa site - documentation and download

 

If you would like to be informed about new articles on I Programmer follow us on Twitter or Facebook or you can subscribe to our weekly newsletter.

 

Banner


Goodbye Google Maps API for Flash
14/08/2014

The, already deprecated, Google Maps API for Flash will be finally switched off on September 2nd. So if you haven't already migrated to the JavaScript version you need to do so pdq (pretty darn quick) [ ... ]



The Raspberry Pi Gets A HAT
23/08/2014

The latest version of the Raspberry Pi single board computer has a new feature that allows it to use expansion cards more intelligently. The new boards are called HATs, Hardware Attached on Top, and t [ ... ]


More News

Last Updated ( Sunday, 28 August 2011 )
 
 

   
RSS feed of news items only
I Programmer News
Copyright © 2014 i-programmer.info. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.