Ballerina: Integration Programming Language

Ayesh Almeida
Ballerina Swan Lake Tech Blog
2 min readMay 8, 2021

Ballerina is an open-source general purpose programming language which is developed by WSO2. Ballerina mainly focuses on API integrations and hence it has a simple but powerful programming model. The current implementation of Ballerina runs on top of the JVM. Ballerina programming language, including the compiler, libraries and all the tooling is completely free and open source and available on github.

First Steps

You could download Ballerina Distribution from here or you could build the Ballerina Distribution from sources. Please read this article for Ballerina environment setup.

Lets write the first Ballerina program;

Save the above code in hello_world.bal and go to command prompt and run following command.

bal run hello_world.bal

You should see following output printed in the command line.

Hello World!

Key Features

Ballerina runs on top of Java Virtual Machine(JVM) so it is totally interoperable with Java. We can easily access Java APIs from Ballerina.

It has both object-oriented and functional programming capabilities. Functions are first class citizens in Ballerina, hence we have higher-order functions and lazy evaluations built into the language.

Ballerina does not have the concept of NULL, instead it has NIL, which is represented by () . If any variable is nillable its type description should define it. Hence Ballerina is safe from NPE (Null Pointer Exception).

Ballerina has Smart Casting.

Ballerina uses a Structural type system. In a structural type system compatibility and equivalence is determined by the structure or the definition of the type but not from the other characteristics like name or place of declaration.

Why you should learn and use Ballerina ?

--

--

Ayesh Almeida
Ballerina Swan Lake Tech Blog

A Tech Enthusiast who wants to build simple solutions for complex problems.