Home > Web > Introduction to Opa, the cloud language.

Introduction to Opa, the cloud language.

Share on TwitterSubmit to reddit

Trying to find new solutions or technologies to develop web applications I discovered Opa, an alternative oriented to cloud computing environments. Opa is a new web development platform available as open source that includes its own language and compiler and offers a solution for scalability, security and integration for web applications.

Opa has been built having cloud computing systems in mind and considering the problematic that presents the development of current web applications as for example to handle a large quantity of users using a rich user interface and needing great scalability resources (social networks, communities or e-commerce sites), that means, all those applications who need to pay especial attention in data and user flexibility, security and scalability.

Nowadays there are a large number of technologies and solutions to develop web applications, however before starting the design and the development we have to consider the web architecture knowing there are several modules that need to fit together to make it work. Typically they are:

  • Web Server
  • User interface
  • Back-end
  • Database

A common solution would be for example to use Apache HTTP Server for the Web server, installing MySQL as database, PHP to create our model/business layer on the server side as back-end and HTML/CSS/JavaScript to build the user interface. Each module will have to be configured separately to fit together into the whole structure and to allow the communication between the modules. However Opa offers an interesting alternative…

Opa integrates all those modules in its platform, so when you develop your web application with Opa your code will cover the server, database, back-end  and user interface in the same language. Therefore there is no need to worry about extra SQL, external modules configurations (as httpd.conf, mysql.ini, etc) or communication and security issues between the modules, a web application becomes one module with Opa. Let’s see it in practice with an example.

Tutorial: Hello World in Opa

Assuming Opa have been already installed, to start with the typical “Hello world” just create a new file in your preferred editor (vi, emacs, etc) and write the following:

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

Save it as “hello_world.opa”, open a shell and compile it using the following command:

opa hello_world.opa

The compiler will generate the necessary files and one executable, to launch it just write:

./hello_world.exe

Displayed in the console you will see the address to access your web application (usually it will be your hostname at the port 8080). Now you can open your web browser and connect to your “Hello world” application. The code you wrote will generate the HTTP server and the code for the served page, only one line for all that, interesting… isn’t it? and what about a cloud computing environment? try the following:

opa-cloud hello_world.exe --host my@server0 --host my@serverN

With the previous command your application will be deployed, load balanced, and running on your N servers.

Conclusion

After learning a bit how to code in Opa to prepare next tutorials I’ve got some conclusions about this alternative. There are pros and cons although at the end I think Opa is an interesting language to learn.

As the positive points:

  • Integration: The new paradigm offered with the all-in-one concept.
  • Distribution: As seen before, the ease of deploying your web application on one or more servers.
  • Scalability: Designed for cloud computing environments.
  • Security: Stronger security is possible due to the integration previously described.

As the negative points:

  • Code sintaxis: To develop in Opa you will have to learn its specific language which sintaxis it’s not similar to other common languages, being at the beginning a bit complex.
  • Flexibility: One of the counterpoint of the integration. The customization of the different modules (database, user interface, etc) will be less flexible.
  • Community size: Opa is a brand new language, so the community is still small. However, there are several active resources (mail lists, stackoverflow, opalang.org) that seem to grow constantly.

Getting started with Opa

To know more about Opa you will find further information, tutorial or examples at www.opalang.org

Don’t hesitate to leave a comment if you want to share your opinion about Opa.

Thanks for visiting semoru.com

Share on TwitterSubmit to reddit

Leave a Reply

Your email address will not be published. Required fields are marked *

*


− 4 = three

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>