SlideShare une entreprise Scribd logo
1  sur  53
Télécharger pour lire hors ligne
Chintana Wilamuna
Solutions Architect
April, 06 2017
A programming language for the networked world
Asanka Abeysinghe
Vice President, Solutions Architecture
Future of Enterprise Integration Meetup: Silicon Valley
The world is changing …
• Networked interactions are no longer a niche
– The new shared library
– Ability to reuse and recompose is key to agility
– Everything you write integrates with other things
• Configuration over code not workable at scale
• Containers, microservices, micro integrations
Centralized vs decentralized
System
Ɣ
System
Ɣ
Service
Foo
Centralized Integration Solution
Service
Bar
System
α
System
β
Service
Foo
Integration
Microservice unit
Service
Bar
System
α
System
β
Integration Microservice unitVs
From data flows to sequence diagrams
• Every ESB technology based on dataflow
• Not very good at describing complex multi-party
interactions that are now common
• Sequence diagrams to the rescue
– Perfect for describing parallel, coordinated activities of many
parties
Timeline
2005
Apache Synapse
2008 Carbon
OSGified
Aug-2016 NEL
Q4-2016
Ballerina:
language spec
Apr-2017
0.85
Feb-2017
0.8 tec.preview
Why stop at using sequence diagrams to describe
programs?
Ballerina
• General purpose programming language, but optimized for
integration
• Strongly typed, concurrent with both text and graphical
syntaxes
• Modern, network-aware, data-aware, security-aware
programming system inspired by Java, Go, Maven, ...
The Ballerina Language
• Graphical/textual parity with ability to switch back and forth
• Common integration capabilities are baked into the language:
– Deep HTTP/REST/Swagger alignment
– Connectors for Web APIs and non-HTTP APIs
– Support for JSON, XML, (No)SQL data and mapping
• No magic – no weird syntax exceptions, everything is derived
from a few key language concepts
• Maximize developer productivity and abstraction clarity
• Support high performance implementations: low latency, low
memory and fast startup
Hello, World!
import ballerina.lang.system;
function main(string[] args) {
system:println("Hello, World!");
}
Demo: hello world
Ballerina knows services (and main)!
• Two models of programming: service and main
• Services are network invoked collections of entry points
• Main is regular main()
Demo: simple service
Ballerina knows data!
• XML, JSON and datatable are built-in data types
• All streamed, high performant
• Data (type) mapping between Ballerina types, XML, JSON and
datatables
Ballerina knows network APIs!
• Client and server connectors for HTTP 1.1/2, WebSockets, JMS,
(S)FTP(S) and more
• Client connectors for BasicAuth, OAuth, AmazonAuth, SOAP
• Client connectors for Web APIs: Twitter, GMail, LinkedIn,
Facebook, Lambda Functions, …
Ballerina knows (or rather, is) Swagger!
• Ballerina programs’ interface (in HTTP case) is
expressed in Swagger
– Text syntax, graphical syntax and Swagger syntax
are interchangeable
• Edit interface anywhere
• No more standard limitations of interface first design
Ballerina knows Docker!
• Built in build command to create Docker image with executable
Ballerina program package
• Run on any container management platform
Ballerina is highly extensible!
• Code organized into packages like Go
• Repository model similar to Maven/NPM/Go giving ability to
create ecosystem of connector contributors
• Recomposable network connectors
Ballerina is open source!
• Patent pending technology
• Implementation released under Apache License v2.0
– Fork me on GitHub: https://github.com/ballerinalang/
• Community
– Users: ballerina-user@googlegroups.com
– Slack: #ballerinalang
– Twitter: @ballerinalang
– StackOverflow: #ballerinalang
– Developers: ballerina-dev@googlegroups.com
Language Walk-Through
https://github.com/ballerinalang/ballerina/blob/master/docs/specification/README.
md
Ballerina Concepts
• Functions
• Services
• Resources
• Connectors
• Actions
• Workers
Modularity: Files & Packages
• Package model inspired by Go
– package org.wso2.foo;
• Packages are defined by the set of all files in a directory
• All symbols exposed by any file in the package is referred to with
packagename:symbolname
– In other words, file names have no meaning in the namespace of the language
• To use symbols from a package you must import:
– import org.wso2.foo [as xx];
• Packages that start with ballerina.* and ballerinax.* are reserved
• Packages will be versioned - details later
Type System
ANY
VALUE TYPE
INT
FLOAT
BOOLEAN
REFERENCE TYPE
BUILT-IN USER DEFINED
STRUCT ARRAY
STRING
MAP
EXCEPTION
MESSAGE
XML
JSON
ITERATOR
XMLDOCUMENT
DATATABLE
JSON Support
• Variables of type “json” can hold any JSON value
• Optionally, can associate a JSON Schema to the
declaration:
– json[<json_schema_name>] jsdoc;
– Constraints the value to conform to the schema
• Useful for type mapping
• JSON literals can be used to initialize JSON typed variables
– json address_json = `{"name" : "$name", "streetName" : "${street}"}`;
XML Support
• Variables of type “xml” can hold any XML element
• Variables of type “xmldocument” can hold any XML
document
• Optionally can associate an XML Schema to constrain the
value space of XML
– xml[<{xsd_namespace_name}type_name}>] e;
• XML literals
– xmlElement address_xml = `<address><name>${name}</name></address>`;
Tabular Data Support
• Variables of type “datatable” can hold any tabular data
coming from a data source
• Database connectors to query and produce datatables
Type Coercion and Conversion
• Lossless type coercions are automatic
– E.g. int -> float
• Other type conversions can be invoked with the cast
operator
– TypeT1 v1;
– TypeT2 v2;
– v2 = (TypeT2) v1;
• Users can define their own type mappers which fit into the
language type system and get invoked with the cast
operator
Type Mappers
typemapper TypeMapperName (TypeName VariableName) (TypeName) {
Statement;+
}
(More constraints coming)
Language Statements
• assignment
• if
• while
• break
• try/catch/throw
• return
• action invocation
• fork/join
• worker initiation/invocation/join/reply
Fork/Join
fork (MessageName) {
worker WorkerName (message VariableName) {
Statement;+
[reply MessageName;]
}+
} [join (JoinCondition) (message[] VariableName) {
Statement;*
} timeout (Expression) (message[] VariableName) {
Statement;*
}]
Fork/Join
Worker Interaction
worker WorkerName (message m) {
Statement;+
[reply MessageName;]
}
• Send/receive message to coordinate
MessageName -> WorkerName;
MessageName <- WorkerName;
Language System
Ballerina is not just the language
• Composer with debugging, type mapping
• IDE plugins
• Docerina
• Testerina
• (Coming soon) Packerina
Composer
• Textual, graphical and Swagger editing of Ballerina
programs
• Runs in the browser
– Currently not packaged with embedded Chromium;
considering it
• Will be hosted in the cloud as well
IDE Plugins
• Available (still WIP)
– Atom
– Vim
– Idea
– Sublime Text
– VSCode
– Adobe Brackets
• More to be done!
– Send a pull request ☺
Docerina
• Tool to generate API docs for your Ballerina code
• All Ballerina code is documented using Docerina
Testerina
• Unit test and mocking framework for Ballerina
Packerina
• Tool to manage repositories, manage dependencies and
build Ballerina programs
• Coming soon under this name .. partly shipping already
Ballerina Future
When should I use Ballerina?
• Write integration microservices
– 80-20 rule: if 80% of your service is about integrating with
other services, data and APIs then use Ballerina. If its just
20% then use Java / Node / Go / XYZ
• Re-compose existing services to be API backends
• Write integration scripts
– Replacement for shell scripts that use curl too much
Integration Microservice in MSA
Summary
Available now: Ballerina v0.85 Technology
Preview
• Language runtime
– Run once, run one service, run many services (bus)
• Developer tools
– Composer: browser based graphic/text/Swagger editor and
debugger
– IDE plugins: Idea, Atom, Vim, Sublime, VSCode, Brackets
– Testerina: Unit testing framework
– Docerina: API doc generation framework
• Connectors
http://ballerinalang.org/
Next Steps
• Download, twirl with it, give us feedback
• Engage with the community
– Users: ballerina-user@googlegroups.com
– Slack: #ballerinalang
– Twitter: @ballerinalang
– StackOverflow: #ballerinalang
– Developers: ballerina-dev@googlegroups.com
Demo: advanced use-cases
Questions?
Ballerina Concepts: Functions
Ballerina Concepts: Resource
Ballerina Concepts: Services
Ballerina Concepts: Client & Server Connectors
• Ballerina services are attached to network protocols with
server connectors
• Ballerina programs interact with network endpoints with
client connectors
– Networked endpoints can mean pretty much anything
WORKERCLIENT
CLIENT WORKER
CONNECTOR
CONNECTOR
CONNECTOR
CONNECTOR
START
REPLY
STATEMENT
ACTION
WORKER2
WORKER2

Contenu connexe

Tendances

Tendances (15)

apidays LIVE India - REST the Events - REST APIs for Event-Driven Architectur...
apidays LIVE India - REST the Events - REST APIs for Event-Driven Architectur...apidays LIVE India - REST the Events - REST APIs for Event-Driven Architectur...
apidays LIVE India - REST the Events - REST APIs for Event-Driven Architectur...
 
Elixir for Rubyists
Elixir for RubyistsElixir for Rubyists
Elixir for Rubyists
 
Go from a PHP Perspective
Go from a PHP PerspectiveGo from a PHP Perspective
Go from a PHP Perspective
 
Scala adoption by enterprises
Scala adoption by enterprisesScala adoption by enterprises
Scala adoption by enterprises
 
[WSO2Con EU 2017] File Processing and Websockets with Ballerina
[WSO2Con EU 2017] File Processing and Websockets with Ballerina[WSO2Con EU 2017] File Processing and Websockets with Ballerina
[WSO2Con EU 2017] File Processing and Websockets with Ballerina
 
Day 9 - PostgreSQL Application Architecture
Day 9 - PostgreSQL Application ArchitectureDay 9 - PostgreSQL Application Architecture
Day 9 - PostgreSQL Application Architecture
 
Client server
Client serverClient server
Client server
 
Introduction to the Web API
Introduction to the Web APIIntroduction to the Web API
Introduction to the Web API
 
Mule ESB Fundamentals
Mule ESB FundamentalsMule ESB Fundamentals
Mule ESB Fundamentals
 
API Facade Pattern with Apache Synapse
API Facade Pattern with Apache SynapseAPI Facade Pattern with Apache Synapse
API Facade Pattern with Apache Synapse
 
Day 2 - Intro to Rails
Day 2 - Intro to RailsDay 2 - Intro to Rails
Day 2 - Intro to Rails
 
Introduction to Apache Synapse
Introduction to Apache SynapseIntroduction to Apache Synapse
Introduction to Apache Synapse
 
Windows 8 Metro apps and the outside world
Windows 8 Metro apps and the outside worldWindows 8 Metro apps and the outside world
Windows 8 Metro apps and the outside world
 
[WSO2Con EU 2017] Exploring Ballerina Toolset
[WSO2Con EU 2017] Exploring Ballerina Toolset[WSO2Con EU 2017] Exploring Ballerina Toolset
[WSO2Con EU 2017] Exploring Ballerina Toolset
 
Api crash
Api crashApi crash
Api crash
 

Similaire à Ballerina- A programming language for the networked world

End-to-end Data Governance with Apache Avro and Atlas
End-to-end Data Governance with Apache Avro and AtlasEnd-to-end Data Governance with Apache Avro and Atlas
End-to-end Data Governance with Apache Avro and Atlas
DataWorks Summit
 
WSO2 Intro Webinar - Simplifying Enterprise Integration with Configurable WS...
WSO2 Intro Webinar -  Simplifying Enterprise Integration with Configurable WS...WSO2 Intro Webinar -  Simplifying Enterprise Integration with Configurable WS...
WSO2 Intro Webinar - Simplifying Enterprise Integration with Configurable WS...
WSO2
 
What's New in AWS Serverless and Containers
What's New in AWS Serverless and ContainersWhat's New in AWS Serverless and Containers
What's New in AWS Serverless and Containers
Amazon Web Services
 
An architecture for federated data discovery and lineage over on-prem datasou...
An architecture for federated data discovery and lineage over on-prem datasou...An architecture for federated data discovery and lineage over on-prem datasou...
An architecture for federated data discovery and lineage over on-prem datasou...
DataWorks Summit
 

Similaire à Ballerina- A programming language for the networked world (20)

Integration Microservices
Integration MicroservicesIntegration Microservices
Integration Microservices
 
Self-Service Data Ingestion Using NiFi, StreamSets & Kafka
Self-Service Data Ingestion Using NiFi, StreamSets & KafkaSelf-Service Data Ingestion Using NiFi, StreamSets & Kafka
Self-Service Data Ingestion Using NiFi, StreamSets & Kafka
 
Venkata
VenkataVenkata
Venkata
 
Developer’s intro to the alfresco platform
Developer’s intro to the alfresco platformDeveloper’s intro to the alfresco platform
Developer’s intro to the alfresco platform
 
End-to-end Data Governance with Apache Avro and Atlas
End-to-end Data Governance with Apache Avro and AtlasEnd-to-end Data Governance with Apache Avro and Atlas
End-to-end Data Governance with Apache Avro and Atlas
 
WSO2 Intro Webinar - Simplifying Enterprise Integration with Configurable WS...
WSO2 Intro Webinar -  Simplifying Enterprise Integration with Configurable WS...WSO2 Intro Webinar -  Simplifying Enterprise Integration with Configurable WS...
WSO2 Intro Webinar - Simplifying Enterprise Integration with Configurable WS...
 
Serverless Web Apps using API Gateway, Lambda and DynamoDB
Serverless Web Apps using API Gateway, Lambda and DynamoDBServerless Web Apps using API Gateway, Lambda and DynamoDB
Serverless Web Apps using API Gateway, Lambda and DynamoDB
 
From 0 to syncing
From 0 to syncingFrom 0 to syncing
From 0 to syncing
 
PLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring SurfPLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring Surf
 
Realizing the promise of portable data processing with Apache Beam
Realizing the promise of portable data processing with Apache BeamRealizing the promise of portable data processing with Apache Beam
Realizing the promise of portable data processing with Apache Beam
 
Schema Registry - Set you Data Free
Schema Registry - Set you Data FreeSchema Registry - Set you Data Free
Schema Registry - Set you Data Free
 
What's New in AWS Serverless and Containers
What's New in AWS Serverless and ContainersWhat's New in AWS Serverless and Containers
What's New in AWS Serverless and Containers
 
Portal and Intranets
Portal and Intranets Portal and Intranets
Portal and Intranets
 
An architecture for federated data discovery and lineage over on-prem datasou...
An architecture for federated data discovery and lineage over on-prem datasou...An architecture for federated data discovery and lineage over on-prem datasou...
An architecture for federated data discovery and lineage over on-prem datasou...
 
IBM Connect 2017: Your Data In the Major Leagues: A Practical Guide to REST S...
IBM Connect 2017: Your Data In the Major Leagues: A Practical Guide to REST S...IBM Connect 2017: Your Data In the Major Leagues: A Practical Guide to REST S...
IBM Connect 2017: Your Data In the Major Leagues: A Practical Guide to REST S...
 
Schema Registry - Set Your Data Free
Schema Registry - Set Your Data FreeSchema Registry - Set Your Data Free
Schema Registry - Set Your Data Free
 
Realizing the Promise of Portable Data Processing with Apache Beam
Realizing the Promise of Portable Data Processing with Apache BeamRealizing the Promise of Portable Data Processing with Apache Beam
Realizing the Promise of Portable Data Processing with Apache Beam
 
vivi
vivivivi
vivi
 
How To Run Your Containers on AWS with ECS & Fargate: Collision 2018
How To Run Your Containers on AWS with ECS & Fargate: Collision 2018How To Run Your Containers on AWS with ECS & Fargate: Collision 2018
How To Run Your Containers on AWS with ECS & Fargate: Collision 2018
 
AWS re:Invent 2016: Accenture Cloud Platform Serverless Journey (ARC202)
AWS re:Invent 2016: Accenture Cloud Platform Serverless Journey (ARC202)AWS re:Invent 2016: Accenture Cloud Platform Serverless Journey (ARC202)
AWS re:Invent 2016: Accenture Cloud Platform Serverless Journey (ARC202)
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Dernier (20)

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

Ballerina- A programming language for the networked world

  • 1. Chintana Wilamuna Solutions Architect April, 06 2017 A programming language for the networked world Asanka Abeysinghe Vice President, Solutions Architecture Future of Enterprise Integration Meetup: Silicon Valley
  • 2. The world is changing … • Networked interactions are no longer a niche – The new shared library – Ability to reuse and recompose is key to agility – Everything you write integrates with other things • Configuration over code not workable at scale • Containers, microservices, micro integrations
  • 3. Centralized vs decentralized System Ɣ System Ɣ Service Foo Centralized Integration Solution Service Bar System α System β Service Foo Integration Microservice unit Service Bar System α System β Integration Microservice unitVs
  • 4. From data flows to sequence diagrams • Every ESB technology based on dataflow • Not very good at describing complex multi-party interactions that are now common • Sequence diagrams to the rescue – Perfect for describing parallel, coordinated activities of many parties
  • 5. Timeline 2005 Apache Synapse 2008 Carbon OSGified Aug-2016 NEL Q4-2016 Ballerina: language spec Apr-2017 0.85 Feb-2017 0.8 tec.preview
  • 6. Why stop at using sequence diagrams to describe programs?
  • 7.
  • 8. Ballerina • General purpose programming language, but optimized for integration • Strongly typed, concurrent with both text and graphical syntaxes • Modern, network-aware, data-aware, security-aware programming system inspired by Java, Go, Maven, ...
  • 9. The Ballerina Language • Graphical/textual parity with ability to switch back and forth • Common integration capabilities are baked into the language: – Deep HTTP/REST/Swagger alignment – Connectors for Web APIs and non-HTTP APIs – Support for JSON, XML, (No)SQL data and mapping • No magic – no weird syntax exceptions, everything is derived from a few key language concepts • Maximize developer productivity and abstraction clarity • Support high performance implementations: low latency, low memory and fast startup
  • 10. Hello, World! import ballerina.lang.system; function main(string[] args) { system:println("Hello, World!"); }
  • 12. Ballerina knows services (and main)! • Two models of programming: service and main • Services are network invoked collections of entry points • Main is regular main()
  • 14. Ballerina knows data! • XML, JSON and datatable are built-in data types • All streamed, high performant • Data (type) mapping between Ballerina types, XML, JSON and datatables
  • 15. Ballerina knows network APIs! • Client and server connectors for HTTP 1.1/2, WebSockets, JMS, (S)FTP(S) and more • Client connectors for BasicAuth, OAuth, AmazonAuth, SOAP • Client connectors for Web APIs: Twitter, GMail, LinkedIn, Facebook, Lambda Functions, …
  • 16. Ballerina knows (or rather, is) Swagger! • Ballerina programs’ interface (in HTTP case) is expressed in Swagger – Text syntax, graphical syntax and Swagger syntax are interchangeable • Edit interface anywhere • No more standard limitations of interface first design
  • 17. Ballerina knows Docker! • Built in build command to create Docker image with executable Ballerina program package • Run on any container management platform
  • 18. Ballerina is highly extensible! • Code organized into packages like Go • Repository model similar to Maven/NPM/Go giving ability to create ecosystem of connector contributors • Recomposable network connectors
  • 19. Ballerina is open source! • Patent pending technology • Implementation released under Apache License v2.0 – Fork me on GitHub: https://github.com/ballerinalang/ • Community – Users: ballerina-user@googlegroups.com – Slack: #ballerinalang – Twitter: @ballerinalang – StackOverflow: #ballerinalang – Developers: ballerina-dev@googlegroups.com
  • 21. Ballerina Concepts • Functions • Services • Resources • Connectors • Actions • Workers
  • 22. Modularity: Files & Packages • Package model inspired by Go – package org.wso2.foo; • Packages are defined by the set of all files in a directory • All symbols exposed by any file in the package is referred to with packagename:symbolname – In other words, file names have no meaning in the namespace of the language • To use symbols from a package you must import: – import org.wso2.foo [as xx]; • Packages that start with ballerina.* and ballerinax.* are reserved • Packages will be versioned - details later
  • 23. Type System ANY VALUE TYPE INT FLOAT BOOLEAN REFERENCE TYPE BUILT-IN USER DEFINED STRUCT ARRAY STRING MAP EXCEPTION MESSAGE XML JSON ITERATOR XMLDOCUMENT DATATABLE
  • 24. JSON Support • Variables of type “json” can hold any JSON value • Optionally, can associate a JSON Schema to the declaration: – json[<json_schema_name>] jsdoc; – Constraints the value to conform to the schema • Useful for type mapping • JSON literals can be used to initialize JSON typed variables – json address_json = `{"name" : "$name", "streetName" : "${street}"}`;
  • 25. XML Support • Variables of type “xml” can hold any XML element • Variables of type “xmldocument” can hold any XML document • Optionally can associate an XML Schema to constrain the value space of XML – xml[<{xsd_namespace_name}type_name}>] e; • XML literals – xmlElement address_xml = `<address><name>${name}</name></address>`;
  • 26. Tabular Data Support • Variables of type “datatable” can hold any tabular data coming from a data source • Database connectors to query and produce datatables
  • 27. Type Coercion and Conversion • Lossless type coercions are automatic – E.g. int -> float • Other type conversions can be invoked with the cast operator – TypeT1 v1; – TypeT2 v2; – v2 = (TypeT2) v1; • Users can define their own type mappers which fit into the language type system and get invoked with the cast operator
  • 28. Type Mappers typemapper TypeMapperName (TypeName VariableName) (TypeName) { Statement;+ } (More constraints coming)
  • 29. Language Statements • assignment • if • while • break • try/catch/throw • return • action invocation • fork/join • worker initiation/invocation/join/reply
  • 30. Fork/Join fork (MessageName) { worker WorkerName (message VariableName) { Statement;+ [reply MessageName;] }+ } [join (JoinCondition) (message[] VariableName) { Statement;* } timeout (Expression) (message[] VariableName) { Statement;* }]
  • 32. Worker Interaction worker WorkerName (message m) { Statement;+ [reply MessageName;] } • Send/receive message to coordinate MessageName -> WorkerName; MessageName <- WorkerName;
  • 34. Ballerina is not just the language • Composer with debugging, type mapping • IDE plugins • Docerina • Testerina • (Coming soon) Packerina
  • 35. Composer • Textual, graphical and Swagger editing of Ballerina programs • Runs in the browser – Currently not packaged with embedded Chromium; considering it • Will be hosted in the cloud as well
  • 36. IDE Plugins • Available (still WIP) – Atom – Vim – Idea – Sublime Text – VSCode – Adobe Brackets • More to be done! – Send a pull request ☺
  • 37. Docerina • Tool to generate API docs for your Ballerina code • All Ballerina code is documented using Docerina
  • 38. Testerina • Unit test and mocking framework for Ballerina
  • 39. Packerina • Tool to manage repositories, manage dependencies and build Ballerina programs • Coming soon under this name .. partly shipping already
  • 41. When should I use Ballerina? • Write integration microservices – 80-20 rule: if 80% of your service is about integrating with other services, data and APIs then use Ballerina. If its just 20% then use Java / Node / Go / XYZ • Re-compose existing services to be API backends • Write integration scripts – Replacement for shell scripts that use curl too much
  • 44. Available now: Ballerina v0.85 Technology Preview • Language runtime – Run once, run one service, run many services (bus) • Developer tools – Composer: browser based graphic/text/Swagger editor and debugger – IDE plugins: Idea, Atom, Vim, Sublime, VSCode, Brackets – Testerina: Unit testing framework – Docerina: API doc generation framework • Connectors
  • 46. Next Steps • Download, twirl with it, give us feedback • Engage with the community – Users: ballerina-user@googlegroups.com – Slack: #ballerinalang – Twitter: @ballerinalang – StackOverflow: #ballerinalang – Developers: ballerina-dev@googlegroups.com
  • 52. Ballerina Concepts: Client & Server Connectors • Ballerina services are attached to network protocols with server connectors • Ballerina programs interact with network endpoints with client connectors – Networked endpoints can mean pretty much anything