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
 
(136 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<ref>{{cite web
|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}}</ref>
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
Opa also handles database queries. It can be compared with [[Web Framework|web frameworks]]<ref>{{cite web
|title=OPA: Language Support for a Sane, Safe and Secure Web, at OWASP 2010}}</ref>, and the source code was released on
|url=http://www.infoworld.com/d/developer-world/infoworld-review-tools-rapid-web-development-297
[[GitHub]]<ref>{{cite web |url=https://github.com/MLstate/opalang |title=GitHub repository |website=[[GitHub]]}}</ref>
|title=InfoWorld article about emerging web technologies, including Opa}}</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]].
 
== ExamplesDesign and features ==
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>
=== Hello world ===
 
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>
The traditional [[Hello world program]] can be written in Opa as:<ref>{{cite web |url=http://www.morganhill.co.uk/cloud/opa-the-cloud-language-test-drive/|title=Opa, the cloud language – a test drive}}</ref>
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 ==
<source lang="c">
{{Portal|Free and open-source software}}
server = one_page_server("Hello", -> <>Hello, web!</>)
* [[Ur (programming language)|Ur]] – a functional language for web development
</source>
* [[Dart (programming language)|Dart]] – a JavaScript alternative for web apps
 
* [[Haxe]] – a similar language for web apps
To compare this to other programming languages see the list of [[hello world program examples]].
* [[CoffeeScript]] – a language [[Source-to-source compiler|transcompiled]] to JavaScript for web apps
 
* Dark – a language integrating development and deployment of [[serverless]] services
This is the full source code of the application, which is compiled by invoking the Opa compiler.
 
<source lang="c">
opa hello_web.opa
</source>
 
The compiler 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.
 
Running the resulting binary launches the web application.
<source lang="c">
./hello_web.exe
</source>
 
To deploy on several instances at once, Opa provides the opa-cloud command. This command launches the application, configures load balancing and makes servers share information automatically.
 
<source lang="c">
opa-cloud hello_web.exe --host localhost --host my@my_server1 --host my@my_server2
</source>
 
== References ==
{{Reflist}}
 
== Bibliography ==
* ''Opa: Up and Running'', 2013, [[O'Reilly Media]] {{ISBN|978-1449328856}}
 
== External links ==
* [http://{{Official website|opalang.org Homepage of Opa]}}
* {{GitHub|MLstate/opalang|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.
* 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]]