Content deleted Content added
No edit summary Tag: Possible self promotion in user or draftspace |
Citation bot (talk | contribs) Removed URL that duplicated identifier. | Use this bot. Report bugs. | #UCB_CommandLine |
||
(32 intermediate revisions by 18 users not shown) | |||
Line 1:
{{Short description|Programming paradigm that unifies the development of different tiers in a single compilation unit}}
'''Multitier programming''' (or '''tierless programming''') is a [[programming paradigm]] for [[distributed computing|distributed software]], which typically follows a [[multitier architecture]], physically separating different functional aspects of the software into different ''tiers'' (e.g., the client, the server and the database in a Web application<ref>{{Cite journal|last1=Hull|first1=Richard|last2=Thiemann|first2=Peter|last3=Wadler|first3=Philip|date=2007|title=07051 Working Group Outcomes – Programming Paradigms for the Web: Web Programming and Web Services|url=http://drops.dagstuhl.de/opus/volltexte/2007/1127|journal=Programming Paradigms for the Web: Web Programming and Web Services|series=Dagstuhl Seminar Proceedings|___location=Dagstuhl, Germany|publisher=Internationales Begegnungs- und Forschungszentrum für Informatik (IBFI)|volume=07051}}</ref>). Multitier programming allows
Concepts from multitier programming were pioneered by the [[Hop (software)|Hop]]<ref name=":0">{{Cite journal|last=Serrano|first=Manuel|date=2012|title=Multitier programming in Hop.|url=https://dblp.org/rec/journals/cacm/SerranoB12.html|journal=Commun. ACM|volume=55|issue=8|pages=53–59|doi=10.1145/2240236.2240253|s2cid=2152326|url-access=subscription}}</ref> and [[Links (programming language)|Links]]<ref name=":1">{{Cite book|last=Cooper|first=Ezra|
and have found industrial adoption in solutions such as
Multitier programming provides a ''global view'' on the distributed system. This aspect has been shown similar to other programming paradigms such as [[choreographic programming]],<ref>{{Cite journal |last1=Giallorenzo |first1=Saverio |last2=Montesi |first2=Fabrizio |last3=Peressotti |first3=Marco |last4=Richter |first4=David |last5=Salvaneschi |first5=Guido |last6=Weisenburger |first6=Pascal |date=2021 |editor-last=Møller |editor-first=Anders |editor2-last=Sridharan |editor2-first=Manu |title=Multiparty Languages: The Choreographic and Multitier Cases |url=https://drops.dagstuhl.de/opus/volltexte/2021/14065 |journal=35th European Conference on Object-Oriented Programming (ECOOP 2021) |series=Leibniz International Proceedings in Informatics (LIPIcs) |___location=Dagstuhl, Germany |publisher=Schloss Dagstuhl – Leibniz-Zentrum für Informatik |volume=194 |pages=22:1–22:27 |doi=10.4230/LIPIcs.ECOOP.2021.22 |doi-access=free |isbn=978-3-95977-190-0|s2cid=235748561 }}</ref> [[macroprogramming]],<ref name="Casadei 2023">{{cite journal | last=Casadei | first=Roberto | title=Macroprogramming: Concepts, State of the Art, and Opportunities of Macroscopic Behaviour Modelling | journal=ACM Computing Surveys | publisher=Association for Computing Machinery (ACM) | date=2023-01-11 | volume=55 | issue=13s | pages=1–37 | issn=0360-0300 | doi=10.1145/3579353 | s2cid=245837830 | doi-access=free | arxiv=2201.03473 }}</ref> and [[aggregate computing]].<ref name="Beal Pianini Viroli 2015 pp. 22–30">{{cite journal | last1=Beal | first1=Jacob | last2=Pianini | first2=Danilo | last3=Viroli | first3=Mirko | title=Aggregate Programming for the Internet of Things | journal=Computer | publisher=Institute of Electrical and Electronics Engineers (IEEE) | volume=48 | issue=9 | year=2015 | issn=0018-9162 | doi=10.1109/mc.2015.261 | pages=22–30| hdl=11585/520779 | s2cid=26413 | hdl-access=free }}</ref><ref>{{Cite journal |last1=Audrito |first1=Giorgio |last2=Casadei |first2=Roberto |last3=Damiani |first3=Ferruccio |last4=Salvaneschi |first4=Guido |last5=Viroli |first5=Mirko |date=2022 |editor-last=Ali |editor-first=Karim |editor2-last=Vitek |editor2-first=Jan |title=Functional Programming for Distributed Systems with XC |url=https://drops.dagstuhl.de/opus/volltexte/2022/16248 |journal=36th European Conference on Object-Oriented Programming (ECOOP 2022) |series=Leibniz International Proceedings in Informatics (LIPIcs) |___location=Dagstuhl, Germany |publisher=Schloss Dagstuhl – Leibniz-Zentrum für Informatik |volume=222 |pages=20:1–20:28 |doi=10.4230/LIPIcs.ECOOP.2022.20 |doi-access=free |isbn=978-3-95977-225-9|s2cid=249961384 }}</ref>
▲'''Multitier programming''' is a [[programming paradigm]] for [[distributed computing|distributed software]], which typically follows a [[multitier architecture]], physically separating different functional aspects of the software into different ''tiers'' (e.g., the client, the server and the database in a Web application<ref>{{Cite journal|last1=Hull|first1=Richard|last2=Thiemann|first2=Peter|last3=Wadler|first3=Philip|date=2007|title=07051 Working Group Outcomes – Programming Paradigms for the Web: Web Programming and Web Services|url=http://drops.dagstuhl.de/opus/volltexte/2007/1127|journal=Programming Paradigms for the Web: Web Programming and Web Services|series=Dagstuhl Seminar Proceedings|___location=Dagstuhl, Germany|publisher=Internationales Begegnungs- und Forschungszentrum für Informatik (IBFI)|volume=07051}}</ref>). Multitier programming allows fuctionalities that span multiple of such tiers to be developed in a single compilation unit using a single [[programming language]]. Without multitier programming, tiers are developed using different languages, e.g., [[JavaScript]] for the Web client, [[PHP]] for the Web server and [[SQL]] for the database.<ref>{{cite journal|last1=Weisenburger|first1=Pascal|last2=Wirth|first2=Johannes|last3=Salvaneschi|first3=Guido|title=A Survey of Multitier Programming|journal=ACM Comput. Surv.|date=2020|volume=53|issue=4|pages=81:1–81:35|doi=10.1145/3397495}}</ref> Multitier programming is often integrated into [[General-purpose language|general-purpose languages]] by extending them with support for distribution.<ref>{{cite book|last1=Caldwell|first1=Sam |editor1-last=Miller|editor1-first=Heather|title=Programming Models for Distributed Computing|date=2016|chapter=General Purpose Languages Extended for Distribution|chapter-url=http://dist-prog-book.com/chapter/5/langs-extended-for-dist.html}}</ref>
▲Concepts from multitier programming were pioneered by the [[Hop (software)|Hop]]<ref name=":0">{{Cite journal|last=Serrano|first=Manuel|date=2012|title=Multitier programming in Hop.|url=https://dblp.org/rec/journals/cacm/SerranoB12.html|journal=Commun. ACM|volume=55|issue=8|pages=53–59|doi=10.1145/2240236.2240253|s2cid=2152326}}</ref> and [[Links (programming language)|Links]]<ref name=":1">{{Cite book|last=Cooper|first=Ezra|date=2006|title=Links: Web Programming Without Tiers.|series=Lecture Notes in Computer Science|volume=4709|url=https://dblp.org/rec/conf/fmco/CooperLWY06.html|pages=266–296|doi=10.1007/978-3-540-74792-5_12|isbn=978-3-540-74791-8}}</ref> languages
▲and have found industrial adoption in solutions such as [[Ocsigen]]<ref name=":2">{{Cite journal|last=Balat|first=Vincent|date=2006|title=Ocsigen: typing web interaction with objective Caml.|url=https://dblp.org/rec/conf/ml/Balat06.html|pages=84–94|doi=10.1145/1159876.1159889|s2cid=6131454}}</ref>, [[Opa (programming language)|Opa]]<ref name=":3">Rajchenbach-Teller, D., & Sinot, Franois-R&#39;egis. (2010). Opa: Language support for a sane, safe and secure web. ''Proceedings of the OWASP AppSec Research'', ''2010''(1).</ref>, [[WebSharper]]<ref name=":4">{{Cite journal|last1=Bjornson|first1=Joel|last2=Tayanovskyy|first2=Anton|last3=Granicz|first3=Adam|date=2010|title=Composing Reactive GUIs in F# Using WebSharper|journal=Proceedings of the 22nd International Conference on Implementation and Application of Functional Languages|page=49|___location=Berlin, Heidelberg|publisher=Springer-Verlag|doi=10.1007/978-3-642-24276-2_13}}</ref>, [[Meteor (web framework)|Meteor]]<ref name=":5">{{Cite book|last=Strack, Isaac|url=https://www.worldcat.org/oclc/823718999|title=Getting started with Meteor JavaScript framework|date=January 2012|isbn=978-1-78216-083-0|___location=Birmingham|oclc=823718999}}</ref> or [[Google Web Toolkit|GWT]]<ref name=":6">{{Cite book|last=Kereki, Federico, 1960-|url=https://www.worldcat.org/oclc/606556208|title=Essential GWT: building for the web with Google Web toolkit 2|date=2011|publisher=Addison-Wesley|isbn=978-0-321-70563-1|___location=Upper Saddle River, NJ|oclc=606556208}}</ref>.
== Context ==
Line 18 ⟶ 15:
== Example ==
At their core, multitier languages allow developers to define for different pieces of code the tiers to which the code belongs. The language features that
===
<syntaxhighlight lang="lisp" line="1">
service echo() {
}
var wss = new WebSocketServer("ws")
wss.onconnection = function(event){
}
</syntaxhighlight>
Line 49 ⟶ 46:
HTML can be embedded directly in Hop code. HTML generated on the server (Line 2–14) is passed to the client. HTML generated on the client can be added to the page using the standard DOM API (Line 6). Hop supports bidirectional communication between a running server and a running client instance through its standard library. The client connects to the WebSocket server through the standard HTML5 API (Line 5) and sends the current input value (Line 10). The server opens a WebSocket server (Line 17) that returns the value back to the client (Line 20). So-called services, which are executed on the server and produce a value that is returned to the client that invoked the service. For example, the echo service (Line 1) produces the HTML page served to the web client of the Echo application. Thus, the code in a service block is executed on the server.
===
<syntaxhighlight lang="java" line="1">
fun echo(item) server {
}
fun main() server {
}
Line 73 ⟶ 70:
Links uses annotations on functions to specify whether they run on the client or on the server (Line 1 and 5). Upon request from the client, the server executes the main function (Line 18), which constructs the code that is sent to the client. Links allows embedding XML code (Line 7–15). XML attributes with the l: prefix are treated specially. The l:name attribute (Line 10) declares an identifier to which the value of the input field is bound. The identifier can be used elsewhere (Line 9). The code to be executed for the l:onsubmit handler (Line 9) is not immediately executed but compiled to JavaScript for client-side execution. Curly braces indicate Links code embedded into XML. The l:onsubmit handler sends the current input value item to the server by calling echo. The item is returned by the server and appended to the list of received items using standard DOM APIs. The call to the server (Line 9) does not block the client. Instead, the continuation on the client is invoked when the result of the call is available. Client–server interaction is based on resumption passing style: Using [[continuation passing style]] transformation and [[defunctionalization]], remote calls are implemented by passing the name of a function for the continuation and the data needed to continue the computation.
===
<syntaxhighlight lang="scala" line="1">
@multitier object Application {
}
</syntaxhighlight>
Line 97 ⟶ 94:
ScalaLoci is a language that targets generic distributed systems rather than the Web only, i.e., it is not restricted to a client–server architecture. To this end, ScalaLoci supports peer types to encode the different tiers at the [[Type system|type level]]. Placement types are used to assign locations to data and computations. ScalaLoci supports multitier [[Functional reactive programming|reactives]] – language abstractions for reactive programming that are placed on specific locations – for composing data flows cross different peers.
The application first defines an input field (Line 11) using the ScalaTags library.<ref>{{Cite web|title=ScalaTags|url=https://com-lihaoyi.github.io/scalatags/|website=www.lihaoyi.com|access-date=2021-10-11}}</ref>
== List of multitier programming languages ==
* Hop/Hop.js<ref name=":0">{{Cite journal|last=Serrano|first=Manuel|date=2012|title=Multitier programming in Hop.|url=https://dblp.org/rec/journals/cacm/SerranoB12.html|journal=Commun. ACM|volume=55|issue=8|pages=53–59|doi=10.1145/2240236.2240253|s2cid=2152326|url-access=subscription}}</ref><ref>{{Cite journal|last=Serrano|first=Manuel|date=2006|title=Hop: a language for programming the web 2.0.|url=https://dblp.org/rec/conf/oopsla/SerranoGL06.html|pages=975–985|doi=10.1145/1176617.1176756|s2cid=14306230|url-access=subscription}}</ref><ref>{{Cite book|last=Serrano|first=Manuel|
* Links<ref name=":1">{{Cite book|last=Cooper|first=Ezra|
*Ur/Web<ref>{{Cite journal|last=Chlipala|first=Adam|date=2015|title=Ur/Web: A Simple Model for Programming the Web.|url=https://dblp.org/rec/conf/popl/Chlipala15.html|pages=153–165|doi=10.1145/2676726.2677004|s2cid=9440677|url-access=subscription}}</ref>
*Eliom/Ocsigen<ref name=":2">{{Cite journal|last=Balat|first=Vincent|date=2006|title=Ocsigen: typing web interaction with objective Caml.|url=https://dblp.org/rec/conf/ml/Balat06.html|pages=84–94|doi=10.1145/1159876.1159889|s2cid=6131454|url-access=subscription}}</ref><ref>{{Cite book|last=Radanne|first=Gabriel|
*ScalaLoci<ref>{{Cite journal|last=Weisenburger|first=Pascal|date=2018|title=Distributed system development with ScalaLoci.|url=https://dblp.org/rec/journals/pacmpl/WeisenburgerKS18.html|journal=Proc. ACM Program. Lang.|volume=2|issue=OOPSLA|pages=129:1–129:30|doi=10.1145/3276499|s2cid=53090153|doi-access=free}}</ref>
*StiP.js<ref>{{Cite book|last=Philips|first=Laure|
*Scala Multi-Tier FRP<ref>{{Cite book|last=Reynders|first=Bob|
*Opa<ref name=":3">Rajchenbach-Teller, D., & Sinot, Franois-
*AmbientTalk/R<ref>{{Cite book|last=Carreton|first=Andoni Lombide|
*ML5<ref>{{Cite book|last=VII|first=Tom Murphy|
*WebSharper<ref name=":4">{{Cite
*Haste<ref>{{Cite journal|last1=Ekblad|first1=Anton|last2=Claessen|first2=Koen|date=2015-05-11|title=A seamless, client-centric programming model for type safe web applications|url=http://dx.doi.org/10.1145/2775050.2633367|journal=ACM SIGPLAN Notices|volume=49|issue=12|pages=79–89|doi=10.1145/2775050.2633367|issn=0362-1340|url-access=subscription}}</ref>
*Fun<ref>{{Cite web|title=Fun (a programming language for the realtime web)|url=http://marcuswest.in/essays/fun-intro/|website=marcuswest.in|access-date=2020-05-04}}</ref>
*Koka<ref>{{Cite journal|last=Leijen|first=Daan|date=2014|title=Koka: Programming with Row Polymorphic Effect Types.|journal=Electronic Proceedings in Theoretical Computer Science|volume=153|url=https://dblp.org/rec/journals/corr/Leijen14.html|pages=100–126|doi=10.4204/EPTCS.153.8|arxiv=1406.2061|s2cid=14902937}}</ref>
*Multi-Tier Calculus<ref>{{Cite book|last=Neubauer|first=Matthias|
*Swift<ref>{{Cite journal|last1=ChongStephen|last2=LiuJed|last3=C|first3=MyersAndrew|last4=QiXin|last5=VikramK|last6=ZhengLantian|last7=ZhengXin|date=2007-10-14|title=Secure web applications via automatic partitioning|url=https://dl.acm.org/doi/abs/10.1145/1323293.1294265|journal=ACM SIGOPS Operating Systems Review|volume=41|issue=6|pages=31–44|language=EN|doi=10.1145/1323293.1294265|hdl=1813/5769 |hdl-access=free}}</ref>
*Volta<ref>{{Cite journal|last=Manolescu|first=Dragos|date=2008|title=Volta: Developing Distributed Applications by Recompiling.|url=https://dblp.org/rec/journals/software/ManolescuBL08.html|journal=IEEE Software|volume=25|issue=5|pages=53–59|doi=10.1109/MS.2008.131|s2cid=24360031|url-access=subscription}}</ref>
*GWT<ref name=":6">{{Cite book|last=Kereki, Federico, 1960-
*Meteor<ref name=":5">{{Cite book|last=Strack, Isaac
*J-Orchestra<ref>{{Cite book|last=Tilevich|first=Eli|
*Hiphop<ref>{{Cite
*Distributed Orc<ref>{{Cite journal|last=Thywissen|first=John A.|date=2016|title=Implicitly Distributing Pervasively Concurrent Programs: Extended abstract.|url=https://dblp.org/rec/conf/ecoop/ThywissenPC16.html|pages=1|doi=10.1145/2957319.2957370|s2cid=6124391|url-access=subscription}}</ref>
*Jif/split<ref>{{Cite journal|last=Zdancewic|first=Steve|date=2002|title=Secure program partitioning.|url=https://dblp.org/rec/journals/tocs/ZdancewicZNM02.html|journal=ACM Trans. Comput. Syst.|volume=20|issue=3|pages=283–328|doi=10.1145/566340.566343|s2cid=1776939|url-access=subscription}}</ref>
*Fission<ref>{{Cite journal|last1=Guha|first1=Arjun|last2=Jeannin|first2=Jean-Baptiste|last3=Nigam|first3=Rachit|last4=Tangen|first4=Jane|last5=Shambaugh|first5=Rian|date=2017|editor-last=Lerner|editor-first=Benjamin S.|editor2-last=Bodík|editor2-first=Rastislav|editor3-last=Krishnamurthi|editor3-first=Shriram|title=Fission: Secure Dynamic Code-Splitting for JavaScript|url=http://drops.dagstuhl.de/opus/volltexte/2017/7124|journal=2nd Summit on Advances in Programming Languages (SNAPL 2017)|series=Leibniz International Proceedings in Informatics (LIPIcs)|___location=Dagstuhl, Germany|publisher=Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik|volume=71|pages=5:1–5:13|doi=10.4230/LIPIcs.SNAPL.2017.5|doi-access=free |isbn=978-3-95977-032-3}}</ref>
*SIF<ref>{{Cite journal|last=Chong|first=Stephen|date=2007|title=SIF: Enforcing Confidentiality and Integrity in Web Applications.|url=https://www.usenix.org/conference/16th-usenix-security-symposium/sif-enforcing-confidentiality-and-integrity-web}}</ref>
*WebDSL<ref>{{Cite journal|last=Groenewegen|first=Danny M.|date=2008|title=WebDSL: a ___domain-specific language for dynamic web applications.|url=https://dblp.org/rec/conf/oopsla/GroenewegenHKV08.html|pages=779–780|doi=10.1145/1449814.1449858|s2cid=8073129|url-access=subscription}}</ref>
*Acute<ref>{{Cite journal|last=Sewell|first=Peter|date=2005|title=Acute: high-level programming language design for distributed computation.|url=https://dblp.org/rec/conf/icfp/SewellLWNAHV05.html|pages=15–26|doi=10.1145/1086365.1086370|s2cid=1308126|url-access=subscription}}</ref>
*Mobl<ref>{{Cite book|last=Hemel|first=Zef|
*High-Level Abstractions for Web Programming<ref>{{Cite book|last=Richard-Foy|first=Julien|
== References ==
{{reflist}}
[[Category:Programming paradigms]]
|