Ballerina: Sri Lanka’s Latest Programming Language

A programming language is what people use to communicate and give instructions to machines. With hundreds of programming languages in existence, and many more being created every day, what use do we have for another one? 

Although it would initially seem that having one standard language would make learning and using code much easier, multiple languages allow programmers to create applications that are both more specialised and diverse. 

Machines and applications develop and change with the way people use them, and so must the programming languages that are used to create them. 

Ballerina, is a new programming language developed by WSO2, an open-source technology provider founded in 2006 by programmers and entrepreneurs, Sanjiva Weerawarana and Paul Fremantle. Their new language is designed especially for emerging cloud-based applications, and to showcase its capabilities, they partnered with the Massachusetts Institute of Technology (MIT) to bring six students to its Colombo office last January, to learn the language along with seven other local students. 

The first team at WSO2, with founders Sanjiva Weerawarana and Paul Fremantle in the centre. Photo Credit: WSO2

Programming Language

Programming languages can be divided into three main categories:

  • A machine language, which is the lowest level language and is easy to understand for computers, although very difficult for people. These instructions give the computer’s central processing unit (CPU) very specific tasks to perform, and programmes are very rarely written in machine code as it is tedious and error-prone. 
  • An assembly language (also called symbolic machine code), which is a representation of machine language and serves as a bridge between instructions written by the programmer, and those executed by the machine. 
  • A high-level language, which is what programmers work with to write software. These include languages like Java, C++, Javascript, etc., which abstract machine instructions into commands and structures that humans can understand and develop easily. Almost all software today is written using high-level languages, ranging from full operating systems to the multitude of applications that run on them. 

Most applications today also require additional software, called middleware, to communicate with the operating system and other applications. Also called ‘plumbing’ or ‘software glue’ it allows multiple applications to share information, and is especially important for programmes which run on a network.

As a developer of middleware, WSO2 created Ballerina in order to integrate its functions within the applications themselves. And as Weerawarana explained, “middleware is dead, because middleware is everywhere.” The growth of digital services, mobile apps, and connected devices means that most applications don’t only function on one device at a time, but in multiple locations simultaneously. 

Ballerina is unique as it takes network distribution into account within the language itself, simplifying how developers can build and deploy cloud-native applications and services — essentially cutting out the middle-ware. 

What Is Special About Ballerina?

First released on September 10, 2019, Ballerina language syntax takes shape based on programming languages such as Java, C++, Go and JavaScript. It brings fundamental concepts, ideas, and tools of distributed system integration into the language. These include distributed transactions, reliable messaging, stream processing, workflows and container management platforms. 

As part of the WSO2/MIT partnership, the 13 students learning Ballerina were given an application to develop. Sanjiva Weerawarana, along with Achala Meddegama, the CEO of Esoft Technologies and founder of Reforest Lanka, worked with the Ministry of Environment to gather a set of requirements. The task was to build a central platform that helped manage environmental aspects like deforestation, reforestation, development, and conservation efforts.

The 13 students who were taught how to use Ballerina as a part of the MIT partnership with WSO2. Photo Credit: WSO2

“The platform allows the Environment Ministry to create, process and issue requests,” explained Tamara Mitrovska, a student in the programme. 

“For example if someone wants to cut some trees in an area or build something, it has to pass through several government departments. Currently, it’s a tedious process. With this app, all the requests can be processed in parallel,” Mitrovska added. 

The programme displays a map of Sri Lanka in which users can select any area of land and then choose what they want to use it for, such as cultivation, constructing a residential building, or constructing a hotel, etc. The app then processes the request through the Ministry, checking for the protection status and zoning regulations of the selected area and determines if the request can be approved or not. 

“I haven’t worked a lot with networking aspects but it is much easier to write services that communicate over a network in Ballerina,” said Sisam Bhandari, one of the MIT students learning the language. “For example, when writing HTTP requests you can see a visual graph that lets you see the connections between the services.”

The interface with Ballerina code and a corresponding graphical representation by means of a sequence diagram. Photo credit: jaxenter.com

Ballerina 1.0, now free to download, provides cloud-native middleware as a programming language for the first time, and it radically simplifies how developers will build and deploy cloud-native distributed applications and services.

“Making the back-end service is a lot more simple,” said Shikar Jagadeesh, another student learning Ballerina. “In a previous project I’ve worked on, the back-end service took a long time to figure out without help. I had to use other services, but with Ballerina it’s much easier to visualise it.”

Ultimately, the language allows the development of programmes that function better in today’s online world. “Modern applications are effectively integrations of services, data, transactions and processes from a vast array of resources to deliver innovative, new services. However, traditional integration approaches have failed to keep pace,” said Weerawarana. 

“The Ballerina programming language is facilitating a major evolutionary leap in the development of cloud-native distributed applications that is tearing down the outdated barriers between app development and integration, to enable greater agility, performance and resilience.”

Related Articles

Exit mobile version