Opa is a new generation of cloud development platform. It is a new programming language, a new web server, a new database and a new distributed execution engine, all of them tightly integrated to provide a great experience for cloud developers.
Throughout the pages of this book, we will introduce you to all the neat features of Opa, and as you will see, they are many. To quote but a few, Opa is concise, simple and readable, it is also extremely powerful, concurrent, dynamically distributed, and extremely secure, much more so than just about any other programming language. Opa is designed to make web development fun, secure and right.
What problem does Opa solve?
This is a great time to be a developer: as a community, we are changing the world, every day, thanks to the web, to the cloud and their myriads of applications. And indeed, web applications and the amount of technologies available to developers have evolved tremendously since the first days of the web.
Unfortunately, the process of web application development has evolved neither quite as far nor nearly as fast. Indeed, developing a web application in 2011 is not so different from developing a PC application in 1991: an impressive amount of developer time is spent not working on features or improvements but on gluing together antagonist technologies that were never designed to quite work together or in this context. In 1991, the technologies were the various hardware components, the low-level operating system, the high-level operating system and the memory itself, which could only be hacked into compliance through copious amounts of machine code. Per se, none of these technologies was wrong, but they just failed to fit together — a problem now known as impedence mismatch.
Today, the technologies involved include the various incompatible browsers, the server components or the database components, to quote but a few. As in 1991, none of these technologies is wrong, but they do not fit together. Because of this impedence mismatch, developers need to add to their application logics copious amounts of glue code just to get the components to agree on communication mechanisms and application-level protocols. Not only is this glue code tedious, repetitive and error-prone, but this is also where most safety and security issues arise.
In 1991, the answer to impedence mismatch was Software Development Kits, and indeed these SDKs proved very useful at allowing developers to develop anything at all, but failed to address the underlying issues. This was only achieved later, through better operating systems, better development tools, and resulted in today’s Java Platform, C#, Objective-C or Python, for instance. In 2011, web frameworks, both client-side and server-side, have the same role as the SDKs of the 1991s, with the same success but also the same shortcomings.
So, while it is a great time to be a developer, we wanted to make it a better time.
How Opa solves it
With Opa, we set out to provide another, better, way of developing cloud applications. Opa is designed to get you to your finished app faster, concentrating only on the interesting parts, without the hassle of writing the glue or of using a programming language that against its original design and without having to keep such a constant watch on low-level security issues.
Opa is a programming language, but it is a programming language vastly more powerful than any programming language you have ever used. Opa offers all the features of a database management system, of a web server, of a server-side framework, of a client-side framework, of a distribution middleware, a security audit tool, but without the complexity of deployment, administration, or impedence mismatch of these technologies.
What Opa is not
While Opa offers all the features that developers have come to expect from a high-end web server, a high-end distributed database management system, frameworks or distribution engine, Opa does not resemble Apache or Tomcat, MySQL or Oracle SQL, Drupal or Ruby on Rails, Google AppEngine or Hadoop.
With a little effort, Opa could certainly be used to mimic some of these components, but that is not how or why Opa was designed. To this day, Opa does not offer a command-line database interface, or mechanisms to serve web pages from the file system, Opa is not a patch on top of a programming language, or a pure engine on top of which a selection of programming languages may be used.
Opa is one technology, consisting in a programming language and its runtime, designed to carry web developers from start to finish of their development, from early prototype to seamless deployment.
What is it good for?
Opa was designed for all users, beginners or seasoned developers, students or professionals, but not for all applications.
Indeed, Opa was built from the bottom-up for Cloud applications, and shines most with applications that require scalability, security, interactivity, real-time web and complex data manipulation.
Think of a social application. Numerous users communicating in real-time by chat, e-mail, forums or other means, through a rich user interface, but also through web services that can be accessed by third-party websites or native mobile interfaces. Perhaps these users can even modify shared appointment tables or work documents. Developers need to combine complex information sources, extract the results quickly and get them back to the user real-time. As the number of users grows, servers must be added, both to store large amounts of data, to manipulate it, and to respond quickly to end-users.
Out of the box, Opa features an impressive support for such scalable storage, heavily concurrent/distributed manipulation of data, service-oriented API and load-balanced web serving. Even better, as social applications commonly require considerable computing power, the computing performance of Opa ensures that fewer machines are required to handle crowds than would be required with other development solutions.
Or think of an e-Commerce store. Highly dynamic web pages, generated constantly from the database, and a user experience that may need to be altered quickly and without disrupting the flow, to match holiday seasons or ongoing ad campaigns, but also a base of orders that needs to be kept secure from would-be intruders, and safe from accidents, including hardware failures.
Opa is also great for this kind of applications. Its content management engine is second to none, whether in flexibility, power or security, Opa’s built-in security checks guarantee that the application will resist most attacks, while the replicated and versioned database ensures that you can always rollback to previous data or recover from outages.
We have used Opa to build social networks, e-Commerce applications, but also multiplayer web games, communication tools, developer-oriented tools — and of course our website.
A first peek at Opa
The rest of the book will introduce you in all details to Opa, but let us take a bit of advance and show you a simple application: Hello, chat.
server = one_page_server("Hello", -> <>Hello, web!</>)
This is the full source code of the application. Without any setup (besides the installation of the compiler), obtaining a complete, deployable application is only a matter of one step:
This command produces a stand-alone executable executable binary, containing everything required for execution, including database management, compiled requests, server code, client code, user interface and everything that may be required to connect them or to handle malicious connexions or inputs. Opa wrote and checked all this code for you. You may now launch the server:
Or, if you prefer, you may deploy it to a cloud:
opa-cloud hello_web.exe --host localhost --host my@my_server1 --host my@my_server2
Your application is launched, load-balanced, and servers share whichever information is necessary.
Welcome to Opa, it really is that simple.
In the following chapters, we will introduce you to the various features and uses of Opa. Each chapter concentrates on writing one specific application, and on how best to achieve this using combinations of skills that you have developed in previous chapters and new skills introduced in this chapter. After this, additional reference chapters recapitulate in detail all the concepts of the language and platform.
This book assumes some knowledge of programming (any language should do) and web pages (knowledge of HTML and CSS will be useful). Any additional knowledge of web applications will let you understand better how much Opa makes development right.
Getting in touch
If you have any question or feedback, do not hesitate to contact us.
A few ways to get in touch:
We will be there!