Skip to Main Content

Ballerina 1.0: All you need to know about the new language by WSO2

Ballerina 1.0 is a programming language that is characterized by being open source, and has now been under development by WSO2 for 3 years. It is targeted at developers, who can use it to code software in a useful and agile way, in an era that is defined by the existence of the cloud. The WSO2 open-source company started considering the idea of developing the best Enterprise Service Bus (ESB) on the market around 2009, and by 2016 it had started developing an entire programming language. Ballerina was pre-released in February of 2017, and it is now a solution that is much-appreciated by industry professionals.

What is Ballerina 1.0?

Ballerina 1.0 is the first language based on the fact that modern application programming implies the creation and use of APIs. This open-source language completely simplifies the way in which developers build and implement native distributed applications and services on the cloud.

 The Ballerina platform is also a response to the increase in digital services, mobile apps and connected devices, which are leading to a significant increase in endpoints. In this category we can include APIs, microservices, processes, data flows, serverless applications, and other resources and digital assets. In light of this, today’s developers require tools and approaches that are more aligned with current times. More specifically, it is difficult for ESB services to cater to the way in which programmers deploy and implement distributed applications and services on the cloud. The fact that Ballerina 1.0 is an open-source program makes their work much easier and efficient, since it is a native cloud middleware as a programming language.

 Ballerina 1.0 is a great leap forward in the field of native distributed cloud application development since it does away with the traditional boundaries that exist between application development and integration. It allows for a better performance, higher speed and improved stability. Indirectly, it is also anticipating the end of the use of the ESB to perform all of these development processes.

What are the features of Ballerina 1.0 and how is it different from the previous version?

Ballerina 1.0 reinvents native cloud middleware. It is the first language based on the concept that modern application programming implies the creation and consumption of APIs. One of its main foundations is the concept of sequence diagrams, which perfectly accommodate microservice patterns and native cloud development. The creation of RESTful APIs and gRPC is concise, simple and clear. The development of APIs on Ballerina by programmers is more effective than on other languages, because the syntax is designed around services, endpoints and network types, such as JSON and ProtoBuf, and simple notations automatically generate deployments for Kubernetes, Docker and Istio.

 Ballerina 1.0 adds a few important changes in this latest version. One of them is an improved language, which includes modifications to the syntax and semantics. It has new features, implements some modules in the standard library and redesigns development tools.

Language with features associated with basic types

As for the language, one of the novelties is that it introduces a set of modules that contain functions associated with basic types. As a whole, these modules are called the ‘lang’ library, and each basic type counts with a corresponding lang library module. In addition, there is also the lang.value module, which contains common functions for all types.

Runtime

As for runtime, this version has a new implementation of jBallerina targeted at the JVM. The jBallerina complier generates an executable JAR file for a Ballerina program, transforming Ballerina sources directly into Java bytecode. With jBallerina, the prior runtime implementation of Ballerina (BVM) will be deprecated and eliminated. jBallerina includes significant performance improvements over the BVM.

Changes to the standard library

As for the changes in the standard library, this programming language now allows for:

  • Renewing the NATS connector so that it is compatible both with NATS and with streaming servers.
  • Introduction of standard module-based library errors to replace the built-in error. For example, Ballerina HTTP error types include http:ClientError, http:ListenerError, http:ClientAuthError, etc.
  • Introduction of the capability to acquire custom providers and handlers for input/output authentication.
  • Introduction of the OAuth2 input authentication.
  • Introduction of proprietary modules for different authentication methods (JWT, LDAP, OAuth2 etc.).
  • Introduction of prior knowledge support for the HTTP/2 client.
  • Addition of flow control support for the HTTP/2 client and server.
  • Introduction of XSLT transformation support.
  • Database client modules ballerina/h2 and ballerina/mysql and the ballerina/sql modules have been discontinued. The ballerinax/java.jdbc client can be used to interact with relational databases.
  • Introduction of messaging support over Kafka.
  • The RabbitMQ, JMS, Artemis, WebSub and LDAP modules are available via the Ballerina Central.
  • APIs for file system operations such as creating files, creating directories, moving directories, renaming files, recovering file metadata, copying files, etc., are now available through the ballerina/files module.
  • Most APIs of the ballerina/encoding module have been eliminated, since they are now supported through the lang library.
  • Three new utility modules were included to manipulate string types, json and xml.

Ballerina 1.0