Ballerina (programming language)

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

Ballerina
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]

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

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]

gollark: Indeed.
gollark: All hail our nebuverlords.
gollark: "Look suspicious"?
gollark: At least they're fairly easy to catch.
gollark: NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO!

References

  1. "Ballerina Language Specification". WSO2.
  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.

Further reading

This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.