Opa (programming language): Difference between revisions

Content deleted Content added
changing nodejs to node.js
Rescuing 2 sources and tagging 0 as dead.) #IABot (v2.0.9.5
 
(22 intermediate revisions by 18 users not shown)
Line 1:
{{short description|Programming language for developing scalable web applications}}
{{Infobox programming language
| name = Opa
| logo = [[File:Opa logo cloud.png|frameless]]
| paradigmparadigms = [[multiMulti-paradigm programming language|multi-paradigm]]: [[functionalFunctional programming|functional]], [[imperativeImperative programming|imperative]]
| typing = [[staticStatic typing|static]], [[strongStrong and weak typing|strong]], [[typeType inference|inferred]]
| year = 2011
| scope = [[Scope (computer science)|lexical]]
| typing = [[static typing|static]], [[strong typing|strong]], [[type inference|inferred]]
| developer = [http://www.linkedin.com/company/mlstate MLstate]
| year = {{Start date and age|2011}}
| latest_release_versionlatest release version = 1.1.01 (stable)
| latest_release_date = {{Release date and age|2013|02|13}}<ref>http://blog.opalang.org/2013/02/some-great-news-on-opa.html</ref>
| 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_systemoperating system = [[Linux]], [[OS XmacOS]], [[Windows]]
| genre = [[Programming language]]
| influenced_byprogramming language = [[OCaml]], Opa, [[ErlangJavaScript]], [[Shell (computing)|Shell]],[[C (programming language)|ErlangC]], [[JavaScriptStandard ML]]
| license = [[MITGNU Affero General Public License|AGPLv3]], [[Affero General PublicMIT License|AGPLv3MIT]]
| website = {{URL|opalang.org}}
| influenced by = [[OCaml]], [[Erlang (programming language)|Erlang]], [[JavaScript]]
}}
 
'''Opa''' is an [[Open-source software|open-source]]a [[programming language]] for developing [[Scalability|scalable]] [[web applicationsapplication]]s. It is [[free and open-source software]] released under a [[GNU Affero General Public License]] (AGPLv3), and an [[MIT License]].
 
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 thea [[serverServer (computing)|server]] and [[JavaScript]] on thea [[clientClient (computing)|client]], with the [[compiler]] automating all communication between the two.<ref>{{cite web |authorlast1=Koprowski |first1=Adam Koprowski|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 actually 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|last1=Robertson |first1=William |last2=Giovanni |first2=Vigna |year=2009|journal=SSYM'09 Proceedings of the 18th conferenceConference on USENIX securitySecurity symposiumSymposium}}{{Dead link|date=April 2020 |bot=InternetArchiveBot |fix-attempted=yes}}</ref>
 
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
|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 licenseLicense]] 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 ==
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=httphttps://www.infoworld.com/darticle/application-development2620269/introducing-opa--a-web-dev-language-to-rule-them-all-172060.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=httphttps://www.infoworld.com/darticle/developer-world2626870/infoworld-review-tools-for-rapid-web-development-297.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 [[functionalFunctional programming|functional]] and has a static [[type system]] with [[type inference]]. Opa also provides sessions which encapsulate an [[imperativeImperative 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 objectcitizen]] 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>
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 web |author=Koprowski, Binsztok |year=2011|url=http://www.lmcs-online.org/ojs/viewarticle.php?id=708&layout=abstract|title=TRX: A Formally Verified Parser Interpreter|publisher=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=French|date=22 June 2011}}</ref>
 
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 webnews|url=http://docnews.opalangidg.orgno/#!cw/manual/Helloart.cfm?id=36C6A408-F2EE-database3929-CB53260EBA6B884F|title=HelloProgramming Opa: Web development, databasereimagined|publisher=Opa[[Computerworld]]|date=1 Documentation}}</ref><ref>{{citeFebruary web2012|url=http://doc.opalang.org/#!/manual/Low-levelarchive-MongoDB-support|titledate=Low-level2 MongoDBOctober support2016|publisheraccess-date=Opa22 Documentation}}</ref><ref>{{citeFebruary news2012|archive-url=https://web.archive.org/web/20161002184533/http://news.idg.no/cw/art.cfm?id=36C6A408-F2EE-3929-CB53260EBA6B884F|titleurl-status=Programming Opa: Web development, reimagined|publisher=[[Computerworld]]|date=1 February 2012dead}}</ref>
The 1.1.0 release in February 2013 also added support for [[PostgreSQL]], paving the way for the support of several [[SQL]] databases.
 
== Examples ==
 
=== Hello world ===
The traditional [[Hello world program]], producing a web server that serves a static page with "Hello, web!" as its content, 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 |date=26 July 2011 |publisher=Morgan Hill |author=Alastair Aitken}}</ref>
 
<source lang="opa">
Server.start(Server.http,
{ title: "Hello"
, page: function() { <h1>Hello, web!</h1> }
}
)
</source>
 
It can be compiled to a stand-alone executable JS file with:
<source lang="bash">
$ opa hello_web.opa
</source>
 
Running the resulting executable JS file launches the web application:
<source lang="bash">
$ ./hello_web.js
</source>
 
== See also ==
{{Portal|Free and open-source software}}
* [[Ur (programming language)|Ur]] - a functional programming language for web development
* [[Dart (programming language)|Dart]] - a JavascriptJavaScript alternative for web apps
* [[Haxe]] - similara programmingsimilar language for web apps
* [[CoffeeScript]] - a programming language [[Source-to-source compiler|transcompiled]] to JavascriptJavaScript for web apps
* Dark – a language integrating development and deployment of [[serverless]] services
 
== References ==
{{Reflist}}
 
== Bibliography ==
* ''Opa: Up and Running'', 2013, [[O'Reilly Media]] {{ISBN|978-1449328856}}
 
== External links ==
* {{Official website|opalang.org}}
* {{GitHub|MLstate/opalang|Opa}}
 
{{JavaScript}}
Line 83 ⟶ 61:
[[Category:Cross-platform free software]]
[[Category:Programming languages created in 2011]]
[[Category:Software using the GNU AGPLAffero licenseGeneral Public License]]
[[Category:Software using the MIT license]]
[[Category:2011 software]]
<!-- Hidden categories below -->
[[Category:Articles with example code]]
[[Category:Statically typed programming languages]]