Multitier programming

From English Wikipedia @ Freddythechick

This is the current revision of this page, as edited by imported>Citation bot at 12:10, 29 July 2024 (Added doi-access. | Use this bot. Report bugs. | Suggested by Headbomb | Linked from Wikipedia:WikiProject_Academic_Journals/Journals_cited_by_Wikipedia/Sandbox2 | #UCB_webform_linked 861/1051). The present address (URL) is a permanent link to this version.

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Multitier programming (or tierless programming) is a programming paradigm for 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[1]). Multitier programming allows functionalities 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.[2] Multitier programming is often integrated into general-purpose languages by extending them with support for distribution.[3]

Concepts from multitier programming were pioneered by the Hop[4] and Links[5] languages and have found industrial adoption in solutions such as Ocsigen,[6] Opa,[7] WebSharper,[8] Meteor[9] or GWT.[10]

Multitier programming provides a global view on the distributed system. This aspect has been shown similar to other programming paradigms such as choreographic programming,[11] macroprogramming,[12] and aggregate computing.[13][14]

Context

The code of the different tiers can be executed in a distributed manner on different networked computers. For instance, in a three-tier architecture, a system is divided into three main layers – typically the presentation, business, and data tiers. This approach has the benefit that by dividing a system into layers, the functionality implemented in one of the layers can be changed independently of the other layers. On the other hand, this architectural decision scatters a cross-cutting functionality belonging to several tiers over several compilation units.

In multitier programming, the different tiers are implemented using a single programming language. Different compilation backends take into account the destination tier (e.g., Java for a server and JavaScript for a web browser). Consequently, a functionality that is spread over tiers can be implemented in a single compilation unit of a multitier program.

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 enable this definition are quite diverse between different multitier languages, ranging from staging to annotations to types. The following example shows an Echo client–server application that illustrates different approaches. In the example, the client sends a message to the server and the server returns the same message to the client, where it is appended to a list of received messages.

Echo application in Hop.js

<syntaxhighlight lang="lisp" line="1"> service echo() {

 var input = <input type="text" />
 return <html>
   <body onload=~{
     var ws = new WebSocket("ws://localhost:" + ${hop.port} + "/hop/ws")

ws.onmessage = function(event) { document.getElemenetById("list").appendChild(

  • ${event.data}
  • ) } }>

           ${input}
           <button onclick=~{ ws.send(${input}.value) }>Echo!</button>