The rise of Ballerina: An important piece of the microservices architecture puzzle
Ballerina is still in pre-1.0 but the project is moving forward. Need proof? WSO2, the creator of Ballerina, recently introduced an Early Access Development Support package to encourage early projects to use this cloud-native programming language. We talked to Paul Fremantle, WSO2 co-founder and CTO about the language’s features, the advantages of using Ballerina with a serverless platform, what’s next for this young language and more.
“Program the world!”
Ballerina became a public open source project in early 2017 but even if this basically makes it a newborn in this industry [Need I remind you that Fortran was “born” in 1954?], it has a lot to offer.
According to the language’s FAQ, “the Ballerina project is currently working towards Ballerina 1, which includes a language specification, a virtual machine, standard libraries, build management, centralized package management at central.ballerina.io, unit test framework, and observability extension.”
Ballerina is an attempt to combine the agility of a type safe programming language with the syntax of integration sequence diagrams. Once compiled, the resulting binaries embed micro engines that perform inline integration semantics such as mediation, orchestration, transformations, asynchrony, event generation and transactions.
We talked to Paul Fremantle, WSO2 co-founder and CTO about the language’s features, the advantages of using Ballerina with a serverless platform, what’s next for this young language and more.
JAXenter: WSO2, the creator of Ballerina, recently introduced the Ballerina Early Access Development Support package. What does that mean exactly?
Paul Fremantle: Ballerina is an open source project and language, and most users are getting support through Stack Overflow and Slack. However, we do have some organizations that want a more formal support arrangement, particularly while Ballerina is still pre-1.0.
We are offering an unlimited query support for Ballerina to encourage these early projects.
JAXenter: Why was this cloud-native programming language created?
Paul Fremantle: Applications are increasingly being created from disaggregated, distributed components such as microservices, APIs, and serverless functions. While many languages have added in capabilities, frameworks or libraries to help with this problem, there are things that can only be done at the core of a language to really solve these problems.
For example, a key part of building scalable network systems is to use asynchronous IO. In languages like Java, the programming libraries for async IO are really complex to use. In Node.js, the callback model makes life really complex. In Ballerina, the programming model is really simple and the async IO is taken care of completely transparently. Another example is the type system which has native support for JSON, XML, gRPC.
Ballerina has a number of aspects that simplify microservices development.
JAXenter: What are the core features of this language?
Paul Fremantle: Services, network endpoints and connectors to remote systems are all first class concepts in the language.
When you call network services, often the messages don’t fit neatly into a single type. For example, a message may be JSON when it’s successful, but some transparent proxy or gateway may return a different type of error, or the network stack can respond with local errors too. In the language, the union type system represents these options very naturally without requiring the developer to create complex objects just to represent that.
A worker concurrency model designed around sequence diagrams, with tools to draw the sequence diagrams directly from the code.
Streams are part of the core language with an integrated query model that allows patterns in streams over time to be captured without complicated code. Direct support for asynchrony and event-based models including WebSub.
Every HTTP service automatically maps to OpenAPI.
Ballerina also has a package management and versioning model built in.
JAXenter: What are the advantages of using Ballerina with a serverless platform?
Paul Fremantle: Serverless platforms are really good at hosting APIs and event-based systems. Ballerina naturally supports creating APIs and event-based services with concise and purposeful code. The type system also fits these use-cases really well. Ballerina already has full support in the OpenWhisk and Kubeless serverless platforms.
JAXenter: How can Ballerina simplify microservices development?
Paul Fremantle: Ballerina has a number of aspects that simplify microservices development.
- Firstly, there are annotations for Docker and Kubernetes that integrate into the build system to generate the container and deployment artefacts directly. Basically with a few lines of integrated code Ballerina generates the Dockerfile and the Kubernetes YAML so you can directly deploy straight into those environments.
- Secondly, a big challenge in microservices environments is the challenge of distributed tracing and observability. Ballerina has built-in support so you can enable tracing, monitoring and observability without adding any extra code. This works with Zipkin, OpenTracing, Prometheus and Honeycomb already.
- Finally, the microservices and cloud-native model is inherently about offering and using network services, which is what Ballerina is designed for.
We really see some opportunities to further optimise the DevOps flows around the language and how we interact with other languages.
JAXenter: What’s next for Ballerina?
Paul Fremantle: We still haven’t finalised the language specification and we continue to optimise and improve it. That is planned to carry on for the rest of this year and then we plan to “lock” the language. There are a bunch of areas we are working on.
- Firstly, we really see some opportunities to further optimise the DevOps flows around the language and how we interact with other languages.
- Secondly, we think there could be ways to represent a collection of linked network services better, and specifically avoiding the overuse of YAML and giving a better strongly typed experience.
- Finally, we are really working on optimising the compilation model. That is a long-term project which is really enthusing the development team.
JAXenter: How can the community get involved?
Paul Fremantle: There are three simple ways. Firstly, the language is still being improved, so any feedback on Stack Overflow, Slack, the mailing list or Github issues is really welcome. Secondly, a Pull Request with an improvement to the language is super welcome. Finally, there are lots of ways the language can be extended including connectors to remote systems, build systems and DevOps.
We’d love to help link to as many systems as possible. Our motto is “program the world!”. Come over to http://ballerina.io to find out more.