Opa (programming language): Difference between revisions

Content deleted Content added
Opadikt (talk | contribs)
No edit summary
Rescuing 2 sources and tagging 0 as dead.) #IABot (v2.0.9.5
 
(145 intermediate revisions by 76 users not shown)
Line 1:
{{short description|Programming language for developing scalable web applications}}
{{noindex}}
{{Infobox programming language
'''Opa''' is a new generation [[programming language]] and web development platform that let you write distributed web applications using a single technology.
| name = Opa
'''Opa''' is [[open source]], released under a dual license: Gnu Affero GPL and a private license.
| logo = Opa logo cloud.png
| paradigms = [[Multi-paradigm programming language|multi-paradigm]]: [[Functional programming|functional]], [[Imperative programming|imperative]]
| typing = [[Static typing|static]], [[Strong and weak typing|strong]], [[Type inference|inferred]]
| scope = [[Scope (computer science)|lexical]]
| developer = [http://www.linkedin.com/company/mlstate MLstate]
| year = {{Start date and age|2011}}
| latest release version = 1.1.1 (stable)
| latest release date = {{Start date and age|2014|03|08}}<ref>{{Cite web |title=Release 1.1.1: MLstate/opalang |url=https://github.com/MLstate/opalang/releases/tag/v4308 |access-date=2021-01-29 |website=GitHub |language=en}}</ref><ref>{{Cite web |title=Some great news on Opa |url=http://blog.opalang.org/2013/02/some-great-news-on-opa.html |access-date=2021-01-29}}</ref>
| operating system = [[Linux]], [[macOS]], [[Windows]]
| programming language = [[OCaml]], Opa, [[JavaScript]], [[Shell (computing)|Shell]],[[C (programming language)|C]], [[Standard ML]]
| license = [[GNU Affero General Public License|AGPLv3]], [[MIT License|MIT]]
| website = {{URL|opalang.org}}
| influenced by = [[OCaml]], [[Erlang (programming language)|Erlang]], [[JavaScript]]
}}
 
'''Opa''' is a [[programming language]] for developing [[Scalability|scalable]] [[web application]]s. It is [[free and open-source software]] released under a [[GNU Affero General Public License]] (AGPLv3), and an [[MIT License]].
The language was first officially presented at the OWASP conference in 2010, and the source code was released on GitHub in June 2011.
 
It can be used for both [[client-side scripting|client-side]] and [[server-side scripting]], where complete programs are written in Opa and subsequently compiled to [[Node.js]] on a [[Server (computing)|server]] and [[JavaScript]] on a [[Client (computing)|client]], with the [[compiler]] automating all communication between the two.<ref>{{cite web |last1=Koprowski |first1=Adam |url=http://www.developer.com/open/opa-vs.-node.js-javascript-framework-comparison.html |title=Node.js vs. Opa: Web Framework Showdown |publisher=developer.com |date=24 February 2012 |access-date=1 March 2012 |archive-date=4 November 2012 |archive-url=https://web.archive.org/web/20121104144936/http://www.developer.com/open/opa-vs.-node.js-javascript-framework-comparison.html |url-status=dead }}</ref><ref>Opa supports various server-side backends, Nodejs being the most popular one.</ref> Opa implements [[Strong and weak typing|strong]], [[static typing]], which can be helpful in protecting against security issues such as [[SQL injection]]s and [[cross-site scripting]] attacks.<ref>{{cite journal |last1=Robertson |first1=William |last2=Giovanni |first2=Vigna |year=2009 |url=http://www.mendeley.com/research/static-enforcement-of-web-application-integrity-through-strong-typing/ |title=Static Enforcement of Web Application Integrity Through Strong Typing |journal=SSYM'09 Proceedings of the 18th Conference on USENIX Security Symposium}}{{Dead link|date=April 2020 |bot=InternetArchiveBot |fix-attempted=yes}}</ref>
== Philosophy ==
 
The language was first officially presented at the Open Worldwide Application Security Project ([[OWASP]]) conference in 2010,<ref>{{cite web |date=June 2010 |publisher=OWASP
Opa is a single programming language for web applications, both for the client and server code.
|url=https://www.owasp.org/index.php/OWASP_AppSec_Research_2010_-_Stockholm,_Sweden#OPA:_Language_Support_for_a_Sane.2C_Safe_and_Secure_Web
|title=OPA: Language Support for a Sane, Safe and Secure Web, at OWASP 2010}}</ref> and the source code was released on
[[GitHub]]<ref>{{cite web |url=https://github.com/MLstate/opalang |title=GitHub repository |website=[[GitHub]]}}</ref>
in June 2011, under a [[GNU Affero General Public License]] (AGPL). Later, the license changed to the [[MIT License]] for the [[software framework]] part (the [[Library (computing)|library]]) and AGPL for the compiler, so that applications written in Opa can be released under any [[software license]], [[Proprietary software|proprietary]] or [[open source]].
 
== Design and features ==
=== What problem does Opa solve? ===
Opa consists of a [[web server]], a [[database]] and distributed execution engine.<ref>{{cite web |url=http://www.webappers.com/2011/07/22/opa-the-scalable-open-source-cloud-language/ |title=Opa – The Scalable Open Source Cloud Language |publisher=WebAppers |date=22 July 2011}}</ref> Code written in Opa is compiled to [[JavaScript]] using [[Node.js]] on the [[Server-side scripting|server side]] and to JavaScript using [[jQuery]] for cross-browser compatibility on the [[Client-side scripting|client side]].<ref>{{cite web |url=http://www.infoq.com/articles/Opa|publisher=InfoQ|title=Interview: François-Régis Sinot on Opa, a Web Development Platform|date=7 September 2011}}</ref>
The advantage of the approach compared to certain [[Rich Internet Application]] (RIA) platforms is that users are not required to install a [[Browser plugin|plugin]] in their browser.<ref>{{cite web |author=Neil McAllister|url=https://www.infoworld.com/article/2620269/introducing-opa--a-web-dev-language-to-rule-them-all.html|publisher=InfoWorld |title=Introducing Opa, a Web dev language to rule them all |date=8 September 2011}}</ref> Opa shares motivations with [[web framework]]s, but takes a different approach.<ref>{{cite web|url=https://www.infoworld.com/article/2626870/infoworld-review-tools-for-rapid-web-development.html|title=InfoWorld review: Tools for rapid Web development|publisher=[[InfoWorld]]|date=12 May 2010}}</ref>
Its designers assert that this helps Opa to avoid many security issues, like [[SQL injection]]s or [[cross-site scripting]] (XSS) attacks.<ref>{{cite web|url=http://www.heise.de/developer/meldung/Auch-Opa-ist-fuer-Cloud-Anwendungen-1288588.html|title=Auch Opa ist für Cloud-Anwendungen |publisher=[[Heise Online]]|date=29 July 2011}}</ref>
 
The core language is [[Functional programming|functional]] and has a static [[type system]] with [[type inference]]. Opa also provides sessions which encapsulate an [[Imperative programming|imperative]] state and communicate using [[message passing]], similar to [[Erlang (programming language)|Erlang]] processes. Opa provides many structures or functions that are common in [[web development]], as [[first-class citizen]] objects, for instance [[HTML]]<ref>{{cite web|url=http://www.i-programmer.info/news/98-languages/2961-opa-a-unified-approach-to-web-programming.html |title=Opa – a unified approach to web programming |publisher=i-Programmer |date=28 August 2011}}</ref> and [[parser]]s, based on [[parsing expression grammar]]s.<ref>{{cite journal |last1=Koprowski |first1=Binsztok |year=2011 |url=http://www.lmcs-online.org/ojs/viewarticle.php?id=708&layout=abstract |title=TRX: A Formally Verified Parser Interpreter |journal=Logical Methods in Computer Science}}</ref> Because of this adhesion between the language and web-related concepts, Opa is not intended for non-web applications (for instance [[desktop application]]s).<ref>{{cite web |url=http://linuxfr.org/news/opa-un-nouveau-langage-pour-le-d%C3%A9veloppement-d%E2%80%99applications-web |title=Opa, un nouveau langage pour le développement d'applications Web|publisher=LinuxFr |language=Fr |date=22 June 2011}}</ref>
When developing a web application, 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. The technologies involved include the various incompatible browsers, the server components or the database components, to quote but a few. None of these technologies is wrong, but they do not fit together. Because of this impedence mismatch, developers need to add to their application logic 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.
 
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]].<ref>{{cite news|url=http://news.idg.no/cw/art.cfm?id=36C6A408-F2EE-3929-CB53260EBA6B884F|title=Programming Opa: Web development, reimagined|publisher=[[Computerworld]]|date=1 February 2012|archive-date=2 October 2016|access-date=22 February 2012|archive-url=https://web.archive.org/web/20161002184533/http://news.idg.no/cw/art.cfm?id=36C6A408-F2EE-3929-CB53260EBA6B884F|url-status=dead}}</ref>
Web frameworks, both client-side and server-side, have tried to address this problem, but the problem remains: Building applications is hackish, relies on glue code and is barely reusable.
The 1.1.0 release in February 2013 also added support for [[PostgreSQL]], paving the way for the support of several [[SQL]] databases.
 
=== HowSee Opaalso solves it ===
{{Portal|Free and open-source software}}
* [[Ur (programming language)|Ur]] – a functional language for web development
* [[Dart (programming language)|Dart]] – a JavaScript alternative for web apps
* [[Haxe]] – a similar language for web apps
* [[CoffeeScript]] – a language [[Source-to-source compiler|transcompiled]] to JavaScript for web apps
* Dark – a language integrating development and deployment of [[serverless]] services
 
== References ==
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 against its original design; also without having to keep such a constant watch on low-level security issues.
{{Reflist}}
 
== Bibliography ==
Opa is a programming language and a standard library comprising a database management system, a web server, a server-side framework, a client-side framework, a distribution middleware, a security audit tool, but without the complexity of deployment, administration, or impedence mismatch stemming from the use of many different technologies.
* ''Opa: Up and Running'', 2013, [[O'Reilly Media]] {{ISBN|978-1449328856}}
 
Developing with Opa is simple: first, write your code with the Opa programming language — and only the Opa programming language, no JavaScript, no SQL, or anything such. Then compile the code, and let Opa analyze security, generate the code for the browser, for the server, for the database, and combine it with the web server. Finally, launch your executable and every browser, including mobile, can connect to your application. There is need to independently deploy, administer or maintain a database management system, a web server, frameworks or middleware. If you have lots of users, deploying in the cloud is just a command away.
 
Simply put, Opa is a programming language and its runtime, designed to carry web developers from start to finish of their development, from early prototype to seamless deployment.
 
== A first peek at Opa ==
 
To illustrate how easy it is to create a web application in Opa, let's see the code of a simple web server displaying "Hello, web!":
 
<source lang="c">
server = one_page_server("Hello", -> <>Hello, web!</>)
</source>
 
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:
 
<source lang="c">
opa hello_web.opa
</source>
 
This command produces a stand-alone executable binary, containing everything required for execution, including database management, compiled requests, server code, client code, user interface and everything that may be needed to connect them or to handle malicious connections or inputs. Opa generated and checked all this code for you. You may now launch the server:
 
<source lang="c">
./hello_web.exe
</source>
 
Or, if you prefer, you may deploy it to a cloud:
 
<source lang="c">
opa-cloud hello_web.exe --host localhost --host my@my_server1 --host my@my_server2
</source>
 
Your application is launched, load-balanced, and servers share whichever information is necessary.
 
== External links ==
* [http://{{Official website|opalang.org Homepage of Opa]}}
* [https://github.com/{{GitHub|MLstate/opalang GitHub repository]|Opa}}
* [http://www.heise.de/developer/meldung/Auch-Opa-ist-fuer-Cloud-Anwendungen-1288588.html Auch Opa ist für Cloud-Anwendungen] article on Heise.
* [http://linuxfr.org/news/opa-un-nouveau-langage-pour-le-d%C3%A9veloppement-d%E2%80%99applications-web Opa, un nouveau langage pour le développement d’applications Web] article on linuxfr.
* [http://www.i-programmer.info/news/98-languages/2961-opa-a-unified-approach-to-web-programming.html Opa - a unified approach to web programming] article on i-Programmer.
* [http://www.webappers.com/2011/07/22/opa-the-scalable-open-source-cloud-language/ Opa – The Scalable Open Source Cloud Language] article on WebAppers.
* [http://www.morganhill.co.uk/cloud/opa-the-cloud-language-test-drive/ Opa, the cloud language – a test drive] article on Morgan Hill's blog.
* Koprowski, Binsztok (2011). [http://www.lmcs-online.org/ojs/viewarticle.php?id=708&layout=abstract "TRX: A Formally Verified Parser Interpreter"]. Logical Methods in Computer Science 7(2), DOI: 10.2168/LMCS-7(2:18)2011.
 
{{JavaScript}}
 
[[:Category:ProgrammingFunctional languages]]
[[Category:Web programming]]
[[fr:Opa]]
[[Category:Cross-platform free software]]
[[Category:Programming languages created in 2011]]
[[Category:Software using the GNU Affero General Public License]]
[[Category:Software using the MIT license]]
[[Category:2011 software]]
<!-- Hidden categories below -->
[[Category:Articles with example code]]
[[Category:Statically typed programming languages]]