Swan Lake beta release of Ballerina programming language
Increasingly enterprises are turning to cloud-native applications that integrate APIs, events, data, microservices, serverless apps, and other digital assets throughout their organisations and across the ecosystems in which they participate. Ballerina is the open-source language for cloud-native programming and integration designed to support these organisations with a unique bidirectional mapping of sequence diagrams and code.
The new Swan Lake Beta release, available today, radically simplifies how developers build and deploy cloud-native applications through an intuitive syntax for developing services and APIs, seamless JSON support, and built-in concurrency control.
“Modern applications are not islands—nor are the teams of developers responsible for building them,” said Dr Sanjiva Weerawarana, Founder of the Ballerina project and 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. 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.”
Ballerina is a 100% open-source project created and sponsored by WSO2. All parts of the project are developed openly here.
Simplifying cloud-native app development
Ballerina is an open-source programming language for the cloud, which is based on the concept that modern application programming revolves around creating and consuming APIs, and it has been designed for cloud-native applications and microservices. Ballerina has all the general-purpose functionality of a modern programming language, and it uniquely provides language abstractions that make it easier to use, combine and create network services.
Notably, Ballerina is the only language where the diagram is the code, and the code is the diagram. Abstractions and syntax for concurrency and network interaction are included in the language to closely correspond with sequence diagrams, which enables a bidirectional mapping for any Ballerina source code between its textual representation and its graphical representation as a sequence diagram.
Highly skilled developers have the flexibility to move between coding with text or diagrams while others have a low-code option for contributing to the organisation’s app development—while maintaining full fidelity to the code.
Ballerina also features a unique structural type system that is more flexible and allows for looser coupling than traditional statically typed language. This is particularly useful 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 that in many cases eliminate serialisation and transformation processing. In other words, the data on the wire is the same as the data in memory for common use cases.
Additionally, as a data-oriented language, Ballerina emphasises plain data that can be used independently of any code that processes the data. It includes 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.
New Ballerina Swan Lake features
With the Swan Lake version, Ballerina introduces several features to help developers build and deploy enterprise-class, cloud-native applications. Notably, it has been redesigned with an intuitive syntax for developing APIs and services, including procedure call (RPC) and RESTful style services and seamless support for JSON. Ballerina also now features both client and service objects that can be configured to use multiple different protocols, using either an RPC-based interface type or a RESTful interface type such as HTTP or GraphQL.
Other key features include:
Concurrency control: Ballerina is inherently concurrent, providing the advantages of asynchronous functions with a simpler programming model. Now, it automatically determines when it is safe to run the concurrent components in an application parallel with the concurrency control features added in Swan Lake.
Powerful constructs for working with data: Ballerina comes with a language-integrated query feature for querying data using a SQL-like syntax and enables type-safe and declarative transformation of JSON, XML, and tabular data. The feature is now fleshed out to support ordering and joins. Furthermore, the table type has been redesigned to be more ergonomic and work consistently with other structural types. Tables in Ballerina are collections of records, in which records are uniquely identified by one of their fields similar to a primary key in SQL.
Automated deployments for kubernetes: With the Swan Lake versions, Ballerina includes the ability to automatically create deployments for Kubernetes and Docker to further simplify the development and deployment of Ballerina code to the cloud. As a result, developers can focus on business logic rather than having to become experts in diverse cloud-native deployment and configuration technologies.
Full development platform
The Ballerina platform provides comprehensive support for modern software engineering processes and toolchains, including:
- A framework for package/module management, including dependency and version control; the new version with Swan Lake also produces repeatable builds for the same source code.
- Ballerina Central, a public web service for sharing modules amongst developers.
- IDE tool plugin for Visual Studio Code supports both textual and graphical development and debugging of Ballerina programs.
- A framework for documentation and testing of Ballerina programs
- Built-in tooling for OpenAPI (Swagger) and gRPC
- New update tool with Swan Lake, which provides built-in functionality for keeping Ballerina installations up to date with the latest releases.
- New shell, an interactive command-line tool that allows developers to rapidly learn and prototype Ballerina code.
- A comprehensive standard library with support for many network protocols, data sources, and data formats to ease the adoption of the language.
Availability and support
The Ballerina Swan Lake Beta is available today. As a fully open-source implementation released under the Apache License 2.0, it does not carry any licensing fees and can be freely downloaded here.