Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

[WSO2 Integration Summit Bern 2019] Ballerina — Cloud-native Middleware as a Programming Language

58 views

Published on

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.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

[WSO2 Integration Summit Bern 2019] Ballerina — Cloud-native Middleware as a Programming Language

  1. 1. Re-inventing middleware in a programming language November 2019 Dr. Paul Fremantle, CTO and Co-Founder, WSO2 @pzfreo #ballerinalang
  2. 2. (Almost) Every programmer is using and/or creating APIs
  3. 3. Existing languages treat the network as simply I/O Ballerina treats APIs, listeners, endpoints, network types as first class entities
  4. 4. Ballerina is a modern, compiled, type safe, concurrent programming language Open Source implementation, Apache Licensed Open Specification, Creative Commons Licensed
  5. 5. Hello World
  6. 6. caller hello GET Hello World
  7. 7. Annotations
  8. 8. caller hello POST (name) Hello, name!
  9. 9. Modules (Connectors)
  10. 10. caller hello POST (status) response twitter tweet (status) response
  11. 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
  12. 12. Based on sequence diagrams
  13. 13. Inherently Async I/O
  14. 14. Network Type System
  15. 15. 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)
  16. 16. Type guard
  17. 17. 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 } ] };
  18. 18. 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;
  19. 19. Cloud native
  20. 20. Batteries included
  21. 21. Batteries included - module and package management
  22. 22. Batteries included ○ Test ○ Documentation ○ Swagger tooling ○ gRPC tooling ○ Secret encryption ○ Docker / Kubernetes integration ○ Istio integration
  23. 23. Serverless
  24. 24. Serverless
  25. 25. Ballerina on AWS Lambda
  26. 26. Observability
  27. 27. Jaeger / Zipkin
  28. 28. Prometheus + Grafana
  29. 29. ElasticSearch / Kibana / Logstash (ELK)
  30. 30. Continuous Integration
  31. 31. OpenAPI / Swagger
  32. 32. $ 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
  33. 33. 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
  34. 34. Learn - Ballerina by Example https://ballerina.io/learn/by-example/
  35. 35. 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
  36. 36. 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

×