WSO2 Ships ‘Swan Lake’ Beta Release of Ballerina Programming Language
Integration software provider WSO2 is serious about cloud native programming, so much so that the company created Ballerina, a programming language built specifically for cloud native computing. Today WSO2 introduced a beta of the latest release of Ballerina, the Swan Lake release.
Ballerina is an open source language for cloud native programming and integration with bidirectional mapping of sequence diagrams and code. The Swan Lake release helps to simplify how developers build and deploy cloud native apps with its syntax for developing services and APIs, JSON support and built-in concurrency, Eric Newcomer, chief technology officer of WSO2, told The New Stack in an interview.
Ballerina is the only language where the diagram is the code, and the code is the diagram, he said.
“We think it’s the only language out there that you can get a sequence diagram from that’s completely in line and in sync with the code,” Newcomer said. “If you change the code at all it redraws the diagram, because the language was created with the intention of being able to draw sequence diagrams from the language.”
The language includes abstractions and syntax for concurrency and network interaction, and closely corresponds with sequence diagrams — which enables bidirectional mapping for any Ballerina source code between its textual representation and its graphical representation as a sequence diagram.
This means that pro developers can move between coding with text or diagrams while less technical staff can use Ballerina in a low-code approach to app development while maintaining full fidelity to the code.
“The low code aspect of Ballerina is the VS Code plugin [for the language] that draws a sequence diagram from the code,” Newcomer said. “The diagram is refreshed for every code change that is saved to GitHub, so it is always up to date. A visual view of the code is always available for reference. In a future version, the diagram will also be capable of generating code, extending the low code concept to starting with the visual representation of the code.”
Modern applications are not islands, nor are the teams that are building them, said Sanjiva Weerawarana, leader of the Ballerina project and also founder and CEO of WSO2.
“The Ballerina language enables developers to create cloud native applications that are inherently integrations of services, data, transactions and processes,” Weerawarana said in a statement. “The new Swan Lake Beta version extends this functionality — further enabling enterprises to tear down the barriers between app development and integration and between highly skilled and ad hoc developers to speed the delivery of innovative, new digital products and services.”
Cloud Native Apps and Microservices
Ballerina was designed for cloud native applications and microservices. It is based on the concept that modern application programming revolves around creating and consuming APIs. While it can be used as a general-purpose programming language, it provides language abstractions that enable developers to use, combine and create network services more easily, the company said.
Ballerina also has a structural type system that allows for looser coupling than traditional statically typed languages. This comes in handy when combining data from multiple, independently designed systems. The type system can be used as a schema to define data transmitted and received over the network, including native data types for JSON and XML.
The overall Ballerina platform includes a framework for package and module management, including dependency and version control. It also features Ballerina Central, a public web service for sharing modules amongst developers. The platform also comes with a plugin for Visual Studio Code that supports both textual and graphical development and debugging of Ballerina programs.
In addition, the Ballerina platform has tooling for OpenAPI and gRPC, and it features native support for GraphQL. It has an interactive command-line tool to help developers prototype Ballerina code, and a new update tool to keep Ballerina installations up to date. And the platform features a library of components with support for many network protocols, data sources and data formats to ease the adoption of the language.
Moreover, Ballerina enables plain data to be used independently of any code that processes the data. It features straightforward mapping of plain data to and from JSON, integrated query with a SQL-like syntax, table and decimal data types, and XML support similar to XQuery, Newcomer said.
“I think the most interesting part is how Ballerina handles data,” said Asanka Abeysinghe, chief technology evangelist at WSO2. “I spend most of my time marshaling and understanding new data types. So the built-in data types in Ballerina representing XML and JSON are huge for me as a backend developer.”
Ballerina also enables the automatic creation of deployments for Kubernetes and Docker to enable simplified development and deployment of Ballerina code to the cloud.
“At the deployment level, once you compile and build the app, you can put it through a CI/CD pipeline and everything you need is there to deploy to Kubernetes,” Newcomer said. “We help developers deal with the complexities of deploying to Kubernetes by allowing them to extract things from the language that will create the right Docker file configurations in the Kubernetes configurations.”
Better than Java for the Cloud
Newcomer also touted Ballerina as better than Java for the cloud, and he dismissed efforts to make Java more cloud-ready. Yet, Ballerina is a JVM language.
“So, while we’ve got the benefit of working in the JVM ecosystem and interacting interoperating with Java code, Ballerina’s still not as lightweight and as agile as we would like it to be for cloud native deployment. So, we’re working on a native implementation of it using LLVM, to create a binary mapping directly to the operating system and being able to call out with a C interface to manipulate operating system resources. That’s scheduled to be done by end of the year.”
But Java is just not ready for primetime in the cloud native world, he said, citing Micronaut, Microprofile, Spring Boot and Quarkus as examples of projects trying to make Java better suited for cloud native applications.
“I’m thinking, what’s going on with this,” he said. “Why invest in trying to retrofit all these cloud native things into Java? This is like object-oriented COBOL. Why not learn a language that is designed for cloud native computing in the first place?”
The Ballerina Swan Lake beta is available today. As an open-source implementation released under the Apache License 2.0, it does not carry any licensing fees and can be freely downloaded at https://ballerina.io/downloads.