Opa is a
programming language
A programming language is a system of notation for writing computer programs.
Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
for developing
scalable web application
A web application (or web app) is application software that is created with web technologies and runs via a web browser. Web applications emerged during the late 1990s and allowed for the server to dynamically build a response to the request, ...
s. It is
free and open-source software
Free and open-source software (FOSS) is software available under a license that grants users the right to use, modify, and distribute the software modified or not to everyone free of charge. FOSS is an inclusive umbrella term encompassing free ...
released under a
GNU Affero General Public License
The GNU Affero General Public License (GNU AGPL) is a free, copyleft license published by the Free Software Foundation in November 2007, and based on the GNU GPL version 3 and the ''Affero General Public License'' (non-GNU).
It is intended fo ...
(AGPLv3), and an
MIT License
The MIT License is a permissive software license originating at the Massachusetts Institute of Technology (MIT) in the late 1980s. As a permissive license, it puts very few restrictions on reuse and therefore has high license compatibility.
Unl ...
.
It can be used for both
client-side and
server-side scripting, where complete programs are written in Opa and subsequently compiled to
Node.js on a
server and
JavaScript
JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior.
Web browsers have ...
on a
client, with the
compiler
In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
automating all communication between the two. Opa implements
strong,
static typing
In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a ''type'' (for example, integer, floating point, string) to every '' term'' (a word, phrase, or other set of symbols). Usu ...
, which can be helpful in protecting against security issues such as
SQL injections and
cross-site scripting attacks.
The language was first officially presented at the Open Worldwide Application Security Project (
OWASP) conference in 2010, and the source code was released on
GitHub
GitHub () is a Proprietary software, proprietary developer platform that allows developers to create, store, manage, and share their code. It uses Git to provide distributed version control and GitHub itself provides access control, bug trackin ...
in June 2011, under a
GNU Affero General Public License
The GNU Affero General Public License (GNU AGPL) is a free, copyleft license published by the Free Software Foundation in November 2007, and based on the GNU GPL version 3 and the ''Affero General Public License'' (non-GNU).
It is intended fo ...
(AGPL). Later, the license changed to the
MIT License
The MIT License is a permissive software license originating at the Massachusetts Institute of Technology (MIT) in the late 1980s. As a permissive license, it puts very few restrictions on reuse and therefore has high license compatibility.
Unl ...
for the
software framework
In computer programming, a software framework is a software abstraction that provides generic functionality which developers can extend with custom code to create applications. It establishes a standard foundation for building and deploying soft ...
part (the
library
A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
) and AGPL for the compiler, so that applications written in Opa can be released under any
software license
A software license is a legal instrument governing the use or redistribution of software.
Since the 1970s, software copyright has been recognized in the United States. Despite the copyright being recognized, most companies prefer to sell lic ...
,
proprietary or
open source
Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use and view the source code, design documents, or content of the product. The open source model is a decentrali ...
.
Design and features
Opa consists of a
web server
A web server is computer software and underlying Computer hardware, hardware that accepts requests via Hypertext Transfer Protocol, HTTP (the network protocol created to distribute web content) or its secure variant HTTPS. A user agent, co ...
, a
database
In computing, a database is an organized collection of data or a type of data store based on the use of a database management system (DBMS), the software that interacts with end users, applications, and the database itself to capture and a ...
and distributed execution engine. Code written in Opa is compiled to
JavaScript
JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior.
Web browsers have ...
using
Node.js on the
server side and to JavaScript using
jQuery for cross-browser compatibility on the
client side.
The advantage of the approach compared to certain
Rich Internet Application (RIA) platforms is that users are not required to install a
plugin in their browser. Opa shares motivations with
web framework
A web framework (WF) or web application framework (WAF) is a software framework that is designed to support the development of web applications including web services, web resources, and web APIs. Web frameworks provide a standard way to build a ...
s, but takes a different approach.
Its designers assert that this helps Opa to avoid many security issues, like
SQL injections or
cross-site scripting (XSS) attacks.
The core language is
functional and has a static
type system
In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a ''type'' (for example, integer, floating point, string) to every '' term'' (a word, phrase, or other set of symbols). Usu ...
with
type inference
Type inference, sometimes called type reconstruction, refers to the automatic detection of the type of an expression in a formal language. These include programming languages and mathematical type systems, but also natural languages in some bran ...
. Opa also provides sessions which encapsulate an
imperative state and communicate using
message passing
In computer science, message passing is a technique for invoking behavior (i.e., running a program) on a computer. The invoking program sends a message to a process (which may be an actor or object) and relies on that process and its supporting ...
, similar to
Erlang processes. Opa provides many structures or functions that are common in
web development, as
first-class citizen objects, for instance
HTML
Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It defines the content and structure of web content. It is often assisted by technologies such as Cascading Style Sheets ( ...
and
parser
Parsing, syntax analysis, or syntactic analysis is a process of analyzing a string of symbols, either in natural language, computer languages or data structures, conforming to the rules of a formal grammar by breaking it into parts. The term '' ...
s, based on
parsing expression grammars. Because of this adhesion between the language and web-related concepts, Opa is not intended for non-web applications (for instance
desktop applications).
The 0.9.0 release in February 2012 introduced database mapping technology for the non-relational, document-oriented database
MongoDB, similar to
object-relational mapping.
The 1.1.0 release in February 2013 also added support for
PostgreSQL, paving the way for the support of several
SQL databases.
See also
*
Ur – a functional language for web development
*
Dart – a JavaScript alternative for web apps
*
Haxe
Haxe is a high-level cross-platform programming language and compiler that can produce applications and source code for many different computing platforms from one code-base. It is free and open-source software, released under an MIT License. ...
– a similar language for web apps
*
CoffeeScript
CoffeeScript is a programming language that compiles to JavaScript. It adds syntactic sugar inspired by Ruby, Python, and Haskell in an effort to enhance JavaScript's brevity and readability. Some added features include list comprehension an ...
– a language
transcompiled to JavaScript for web apps
* Dark – a language integrating development and deployment of
serverless services
References
Bibliography
* ''Opa: Up and Running'', 2013,
O'Reilly Media
O'Reilly Media, Inc. (formerly O'Reilly & Associates) is an American learning company established by Tim O'Reilly that provides technical and professional skills development courses via an online learning platform. O'Reilly also publishes b ...
External links
*
*
{{JavaScript
Functional languages
Web programming
Cross-platform free software
Programming languages created in 2011
Software using the GNU Affero General Public License
Software using the MIT license
2011 software
Articles with example code
Statically typed programming languages