Ballerina (programming language)

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Ballerina
Ballerina Language
Designed bySanjiva Weerawarana, James Clark, Sameera Jayasoma, Hasitha Aravinda, Srinath Perera, Frank Leymann and WSO2[1]
DeveloperWSO2
First appeared2017
Typing disciplineStructural, strong, static, inferred
OSCross-platform
LicenseApache License 2.0[2]
Websiteballerina.io
Influenced by
Java, Javascript, Go, Rust, C#[3]

Ballerina is a general-purpose programming language with features optimized for network distributed[disambiguation needed] applications. It is easy to write and modify and is suitable for application programmers.[4][5][6]

It is an open source project [7] started in 2015 by architects from WSO2 as code-based alternative to the configuration-based integration tools such as EAI, ESB, and workflow products.[8][9]

Ballerina has various constructs geared toward cloud-native development including support for modern data formats and protocols, reliability, distributed transactions, APIs, and event streams.[10][11]

Examples[edit]

A simple hello world service is depicted below.

// To start the service, navigate to the directory that contains the
// `.bal` file and execute the `ballerina run` command.

import ballerina/http;
import ballerina/log;
service hello on new http:Listener(9090) {

    resource function sayHello(http:Caller caller, http:Request req) {

        var result = caller->respond("Hello, World!");

        if (result is error) {
            log:printError("Error sending response", err = result);
        }
    }
}

Print “Hello, World!” in parallel using workers

import ballerina/io;

public function main() {
    worker w1 {
        io:println("Hello, World! #m");
    }

    worker w2 {
        io:println("Hello, World! #n");
    }
    worker w3 {
        io:println("Hello, World! #k");
    }
}

[12]

References[edit]

  1. ^ "Ballerina Language Specification" (PDF). WSO2. 2018-05-01. Retrieved 2018-05-03.
  2. ^ "WSO2 / LICENSE". github.com. WSO2. 2017-03-08. Retrieved 2018-03-01.
  3. ^ "Ballerina, A modern programming language focused on integration" (PDF): 15. Cite journal requires |journal= (help)
  4. ^ Jackson, Joab. "Ballerina: An API-First Programming Language". The New Stack. Retrieved 2018-06-11.
  5. ^ Foremski, Tom (2019-03-01). "Technology and the Arts: Celebrating Ballerina, a computer language of integration". Retrieved 2019-07-14.
  6. ^ Lawton, George (2018-11-01). "Ballerina language promises to improve app integration". Retrieved 2019-07-23.
  7. ^ Open Source Contributors (18 June 2019). "Ballerina source code". GitHub.
  8. ^ "Ballerina Microservices Programming Language: Introducing the Latest Release and "Ballerina Central"". InfoQ. Retrieved 2018-06-07.
  9. ^ Earls, Alan (2019-03-01). "How does Ballerina stack up as a cloud-native programming language?". Retrieved 2019-07-23.
  10. ^ Posta, Christian. "Evolution of Integration and Microservices with Service Mesh and Ballerina". Retrieved 2019-07-24.
  11. ^ staff, Techworld. "Top programming languages you should try". Techworld. Retrieved 2018-06-07.
  12. ^ Ballerina Team (18 June 2019). "Using workers". ballerina.io.

External links[edit]