3. In this session
Why we need a new programming language?
What is Ballerina?
Key features of Ballerina
Demo - Develop a REST service using Ballerina
Open source contributions to Ballerina
4. Application development process
● Write code to integrate many systems
● Test and document the code
● Build and package into Docker
● Write deployment descriptors
● API management and security
● Scaling and performance
● Observe the usages and analytics
● Adjust and redeploy
5. Why we need a new programming language?
○ Better network abstractions
○ Better support for data representation
○ Network aware type system
○ 1st Class support for a wide spectrum of network protocols
○ Ability to handle concurrency easily
○ Cloud friendliness
○ Visual representations for the full picture
○ Should be a complete platform, not just a language
6. History of Ballerina?
○ Started in 2016 by WSO2.
○ A general-purpose programming language.
○ Specializes in solving integration & cloud-based problems by providing the
right level of language abstractions and tools.
○ Open-source project and driven by the community.
7. What is Ballerina?
○ Data-Oriented
○ Language has objects, the development methods are not completely OOP-based.
○ Both objects and functions are first class concepts, giving developers the ability to choose
the best option based on their requirements.
○ Primary focus is on represent, describe, communicate pure data.
○ Compiled
○ Flexibly typed
○ Concurrent
○ Ballerina is NOT a JVM language. It has two implementations.
○ jBallerina - written in java to run on top of JVM and generate JVM bytecode . This is the
first implementation to prove the language.
○ nBallerina - Compiled using LLVM, directly to the platform architecture.
8. Ballerina Provides Network Abstractions
○ Provides abstractions for both network
services and network clients.
○ For clients - Client objects with remote
methods to represent outbound network
messages
○ For services - Service objects
○ A remote method on a service object
represents a network-callable method.
○ A resource method, which enables a
more data-oriented view of services.
○ Incoming network messages are
dispatched to service objects by using
objects implementing the
language-defined Listener type.
9. Ballerina has Network-Aware Data & Type System
● Ballerina’s type system is specifically focused
on aiding the development of networked and
distributed applications.
● Plain Data
○ Messages exchanged by network
protocols are represented by plain
data
○ This is called anydata in Ballerina
○ Can be directly serialized to and from
JSON in a simple, natural way.
● Ballerina has a structural type system
○ Type compatibility is identified by
considering the structure of the value
rather than just relying on the name of
the type.
10. Code to Cloud with Ballerina
● Ballerina provides a unique developer
experience to move from code to cloud.
● The Ballerina compiler can be extended to
read the source code and generate artifacts
to deploy your code into different clouds.
● These artifacts can be Dockerfiles, Docker
images, Kubernetes YAML files, or serverless
functions.
● Building the source with
○ bal build --cloud=k8s Generate the
Kubernetes YAML files and Docker image
○ bal build --cloud=docker
Generate the Docker image and Dockerfile
11. Ballerina is Concurrent, Reliable & Maintainable
● With more and more applications needing to
support network interaction, concurrency
becomes important for handling scale.
○ Asynchronous function calls - calls a function
asynchronously and the function runs on a
separate logical thread
○ Workers - Represents a single strand of a
function invocation.
○ A strand is a logical thread of control assigned
to every worker, which is multitasked
cooperatively instead of preemptively.
● Ballerina runtime has built-in support for
interacting with a transaction manager.
○ language provides syntax for delimiting
transactions.
13. Ballerina is a Platform
Ballerina has:
- "The language" - This is the core and it's the part that's defined in the
language specification.
- "Platform" - The language has been designed in conjunction with key
components of the surrounding ecosystem
The platform includes:
● a standard library
● a centralized module repository, and the tooling needed to support that
● a documentation system (based on Markdown)
● a testing framework
● extensions/plug-ins for popular IDEs (notably Visual Studio Code).