Ballerina is a statically typed, concurrent programming language, focusing on network interaction and structured data. One of its key objectives is to make providing and consuming services easier by baking concepts such as listeners, services, and endpoints as inherently concurrent first-class language constructs. Another important aspect of the language is the sequence diagram based graphical view which shows the most fundamental aspect of the semantics of a network distributed application. Ballerina language is pragmatic and intended for commercial adoption and provides familiarity for users of Java, C#, and JavaScript. While it looks like Java and other popular languages in some ways, it is very different from those in fundamental ways.
In this deck, Paul Fremantle, will discuss and demonstrate how Ballerina simplifies your microservices development. Also, he will show you how Ballerina is different, why it's different, and how those differences give Ballerina an unfair advantage when it comes to developing resilient, performant, and secure network services and applications.
3. Existing languages treat the
network as simply I/O
Ballerina treats APIs, listeners,
endpoints, network types as first
class entities
4. Ballerina is a modern, compiled, type safe,
concurrent programming language
Open Source implementation,
Apache Licensed
Open Specification,
Creative Commons Licensed
11. Security
○ Built in taint analysis
○ Built in API Gateway (JWT and OAuth)
○ Research on embedding SPIFFE into the language
○ First-class integration with Istio / Envoy
More info here:
https://github.com/prabath/ballerina-security
16. Union types
○ A type defined by union of two or more other types
float | string v1 = "John";
float | string v2 = 457.68;
float | string
0.51
1.01
457.68
-11.0
“John”
“name”
“”
“bal”
// The return type of 'post' is a union of 'http:Response' and 'error'
http:Response | error response = orderEP -> post("/create", reqPayload)
18. JSON as a native type
json is just a union - () | int | float | string | map<json> | json[]
// JSON object
json payload = { "orderdata": { "id": 1, "name": "XYZ", "price": 2500 } };
//Access object values
json orderid = payload.orderdata.id;
//JSON arrays
json orders = {
"orderdata": [
{ "id": 1, "name": "XYZ", "price": 2500 },
{ "id": 2, "name": "ABC", "price": 3000 }
]
};
19. XML as a native type (experimental)
// Simple XML literal
xml x1 = xml`<name>Paul Fremantle</name>`;
// XML with namespaces
xmlns "http://wso2.com" as ns0;
xml x2 = xml `<name id="123" status="married">
<ns0:fname>Paul</ns0:fname>
<ns0:lname>Fremantle</ns0:lname>
</name>`;
// XML literal with interpolation
string lastName = "Fremantle";
xml x3 = xml`<lname>${lastName}</lname>`;
// Concat XML values
xml x4 = x1 + x2 + x3;
36. $ ballerina openapi gen-contract hello -i demo.bal
Note: This is an Experimental tool shipped under
ballerina hence this will only support limited set
of functionality.
Successfully generated the ballerina contract at
location
/Users/paul/10demo/hello.openapi.yaml
37.
38. Everything demo’ed is in Github
My setup
● Ballerina 1.0.2
● Docker
○ 2.1.5.0 edge
○ Kubernetes: v1.15.5
● Visual Studio Code 1.39.2
● Ballerina vscode plugin 1.0.1
40. How to get involved?
○ Come to https://ballerina.io
○ Join the slack channel and/or ballerina-dev mailing list
○ Create a package
○ A connector to your project or favourite endpoint!
○ Create issues
○ On the spec or implementation
○ If you have compiler skills, submit PRs on nBallerina or jBallerina
41. Where to find out more?
Homepage https://ballerina.io/
Downloads https://ballerina.io/downloads/
Ballerina By Example https://ballerina.io/learn/by-example/
Github https://github.com/ballerina-platform/ballerina-lang