SlideShare a Scribd company logo
1 of 42
Ballerina is not Java (or Go or ..)
Sanjiva Weerawarana, Ph.D.
Founder, Chairman & Chief Architect; WSO2
BallerinaCon – San Francisco, July 18, 2018
Motivation: Why yet another language?
• Digital transformation
– Everything is a network service
– Produce, not just consume network services
– Every business has to become a software company
• Minimalization of computing
– Hardware  VMs  Containers  Serverless
– SOA  Microservices
– ESB  Service meshes
• Middleware is dead; middleware is everywhere
– Servers  sidecars  code
7/21/2018 2
Design motivation: Sequence diagrams
• Used to describe how complex systems work
• Why not use that as the abstraction for code?
7/21/2018 3
Design principles
• Code with equivalent both text and graphic syntaxes
• Do not try to hide the network
• First class support for network data types
• Make programs network resilient by default
• No room for best practices or “findbugs”
• Make programs secure by default
• No dogmatic programming paradigm
• Mainstream concepts & abstractions, not research
7/21/2018 4
Unusual aspects of Ballerina
• Structural type system with network friendly types and unions
• First-class nature of application level network abstractions
• Graphical with sequence diagrams
• Sequence diagram based parallelism model
• Errors and exceptions
• Traditional middleware is in the language
– API mgmt, ESB like integration, data integration, streaming analytics, identity
• Language extensibility with environment binding and compilation extensibility
• Integrated query and streaming query
• Language level security abstractions
• Event driven runtime
• Not afterthoughts:
– Documentation
– Version management
– Dependency management
– Testing
7/21/2018 5
Values
• Simple values: (), boolean, int, float, decimal, string
• Structured values: tuple, array, map, record, table, xml, error
• Behavioral values: function, future, object, stream, typedesc
7/21/2018 6
Simple values
7/21/2018 7
10, 98
0 100.98
10.0 100.980
“would”
“wouldn’t” true false
string
decimal
float
int
boolean
()
Structured values
7/21/2018 8
{{“x”: y,
“a”: 20},
{“foo”:
“bar”}, …}
{[10, “20”],
(“x”, 20,
true), ...}
mappings
lists
{ ...}
tables
{ ...}
errors
{<f>1</f>,
<a>b</a>,
…}
xml
Behavioral values
• function
• future
• object
• stream
• typedesc
• (few more coming)
7/21/2018 9
Type descriptors
• A type descriptor describes a set of values
– Membership test for a set
• A type is a label for the set
• Note: a given value can be in any number of sets
7/21/2018 10
Basic types
• Names for the fundamental value sets
– int, float, …
• Type constructors
– map, record, …
7/21/2018 11
Broad vs. narrow type
string s = “x”;
• What type is the value “x”?
– Narrow type: Singleton type with just that value: { “x” }
– Broad type: string
7/21/2018 12
Mapping types
• Mappings are collections of (name, value) pairs
• Variations
– Open vs. closed mappings
– Required vs. optional fields
• “record” type constructor
– Collection of mandatory and optional named fields of any types
– Open if desired
• “map” type constructor
– Any fields but all values of a single type
– Always open
• Covariant subtypes
– Storage type
7/21/2018 13
List types
• Ordered sequence of values
• Variations: fixed length vs. variable length
• Array constructor
– Single member type
– Fixed or variable length
• Tuple constructor
– Sequence of values of various member types
– Fixed length
7/21/2018 14
XML
• Minimalistic but powerful native xml type
• Non-traditional XML architecture
– xml is sequence of things that appear in XML (elements, comments,
text, ..)
– Elements do not contain references to parent or siblings and same
element can appear in multiple xml values
– No node identity, no text nodes (just strings)
– Namespaces married to Ballerina qualified name architecture
• Literal XML values, reading/writing
7/21/2018 15
Tables
• Tabular data
– Programmatically generated & manipulated
– Database connectors to load/store tables
• Integrated SQL-like query, ala C# LINQ
– In-memory database
– Table rows are just records (no ORM)
7/21/2018 16
Errors
• Errors are their own value space
– (reason (string), details (map), stacktrace)
7/21/2018 17
Other types
• Unions
• Finite types
• Optional
• json
• byte
• any
7/21/2018 18
Union types
• Type defined by union of two or more other types
– Remember, a type is name for a set of values
• E.g.:
type IntOrString float | string;
IntOrString v1 = “yo”;
IntOrString v2 = 3.141592;
7/21/2018 19
0 100.98
“would”
“wouldn’t”
Finite types
• Remember, a type is name for a set of values
• Sets can have finite number of values as well
type ThisOrThat “this” | “that” | 17;
7/21/2018 20
Optional types
• Variable can be declared to holding a value of a particular
type or no value at all
int? foo;
Person? bar;
• No null pointers in Ballerina!
7/21/2018 21
json
• json is just a union
– () | int | float | string | map<json> | json[]
• json objects are most commonly used
– map<json>, but subtyped to an open record with non-mandatory
fields in most cases
– Very useful for man-in-the-middle network scenarios
• With json being within the type system, no data binding
concept needed for json
7/21/2018 22
byte
• Just a predefined union:
type byte 0 | 1 | … | 255;
• We avoid all the problems of different kinds of math for
different numeric sizes
7/21/2018 23
any
• Predefined name for union of all built-in and user-defined
types
7/21/2018 24
Casting and conversions
• Casting is defined by set membership: if the value is a
member of the L-Value type then it can be casted, otherwise
no
– Value doesn’t change (of course)
• ZERO automatic conversions
– Not even int -> float
• Future: data transformation constructs
7/21/2018 25
Type matching
• Union typed expressions have to be separated out before use:
match expression {
pattern [var] => statement;
pattern [var] => statement;
..
}
• Or within an expression:
expression but { pattern [var] => expression }
7/21/2018 26
Errors and error lifting
• Errors are its own value space
• Can be returned or thrown
– Often returned as T | error
– Throwing is discouraged and meant to be used rarely
• Error lifting
– Many functions return ResultType | error
– Check expression: check expression
• If error return immediately, else error is eliminated from type set
7/21/2018 27
Nil & error lifting navigation
• Navigating deep hierarchies is common in integration code
• Navigating through optional types are nil-lifted by “.”
operator: a.b.c
• Navigation is both nil and error lifted by “!” operator: a!b!c
• Why?
– Combination of optional types and type matching makes it impossible
to have a null reference in Ballerina
– Nil & error lifting make those rules palatable
7/21/2018 28
NETWORK
7/21/2018 29
Endpoints
• Endpoints represent network termination points for incoming network
interactions or outgoing network interactions plus set of typed
interactions that are allowed
• Ingress vs. egress endpoints
• Egress endpoints represent remote systems
– Offer a set of actions for interaction with them
• Ingress endpoints are network entry points to a Ballerina runtime via a
registered service
– Calls are delivered to a particular resource in a service
– Offers incoming endpoint list of actions to reply/message
• Modeled as an actor in sequence diagram
7/21/2018 30
Network interactions
• Programmer needs to be made aware that this is a network
call
– Graphically line from a worker to an endpoint
– Textually:
var result = epName->actionName (args);
• If any errors occur they need to be type matched and handled
7/21/2018 31
Outbound resiliency
• Failure is normal in network interactions
• Endpoints are logical
– Group them for load balancing, failover or other behaviors
• Circuit breaking, bulk-heading, timeouts, load management all
part of endpoint architecture
7/21/2018 32
Services & resources
• Service is a collection of resources where each resource is
network invokable via ingress endpoints
• Services must be attached to an endpoint to be invoked
• Responses must be via endpoint and not by returning values
– Responses may not go
7/21/2018 33
Ballerina graphical notation
• Sequence diagrams focused on showing worker and endpoint
interactions
– Endpoints represent network services
• Each worker is sequential code
– We can zoom in graphically but its really just code
• Not meant to be used for low-code / no-code or by non-
programmers
– Meant to make it easier to understand complex distributed
interactions
7/21/2018 34
Always-on parallelism
• Every executable entity (function, method, resource) is a
collection of workers
– Line in a sequence diagram
• Each worker is a independent execution context
• All workers of a function execute concurrently when the
function is called
7/21/2018 35
Always-on parallelism
7/21/2018 36
Blocking function invocation
• Protocol
– Initialization: start endpoints
– Start concurrent workers
– First one to return will release caller
• Others continue to completion
• If no one completes (e.g. due to failures) function call fails
with “call failed” exception
• Results in a cactus stack instead of a traditional call stack
7/21/2018 37
Non-blocking invocation and futures
• Any function can be called in a non-blocking way:
future<T> f = start functionName (args)
• Wait for completion, cancel, get return values via typed future
7/21/2018 38
Worker to worker communication
• Via anonymous channels, non-blocking for send, blocking for
receive
• More comprehensive patterns coming
7/21/2018 39
Implementation
• Compiler produces mid level intermediate representation
(BVM bytecodes) into library (.balo)
– Portable object format
• Extensible architecture for compiler to allow 3rd party
annotation processing to become part of compilation process,
e.g. Docker/K8s
• IDEs supported via Language Server Protocol
– Plugins for VS Code, IntelliJ and standalone browser-based Composer
• Current runtime is a Java based interpreter for mid level IR
– Will be compiled via LLVM to native code
7/21/2018 40
Ongoing work
• Concurrency management with STM, uniqueness types
• Workflow related
– Forward recoverability
– Compensation
– Checkpoint and restart
• Docker / Kubernetes compositions
• Generic types
• Internationalizing the grammar
• Implementation
– Native compilation via LLVM
– Also WebASM
7/21/2018 41
Summary
• Ballerina is an attempt to build a modern industrial grade
programming language
– For future with lots of network endpoints
• Type system is designed to make network data processing easier
• First class network services along with functions/objects
• Framework to encourage more secure code
• Fully open source and developed openly
7/21/2018 42

More Related Content

Similar to 2018 07-ballerina-ballerina con

Revolutionise your Machine Learning Workflow using Scikit-Learn Pipelines
Revolutionise your Machine Learning Workflow using Scikit-Learn PipelinesRevolutionise your Machine Learning Workflow using Scikit-Learn Pipelines
Revolutionise your Machine Learning Workflow using Scikit-Learn PipelinesPhilip Goddard
 
Data structure and algorithm.
Data structure and algorithm. Data structure and algorithm.
Data structure and algorithm. Abdul salam
 
Diksha sda presentation
Diksha sda presentationDiksha sda presentation
Diksha sda presentationdikshagupta111
 
UML (Hemant rajak)
UML (Hemant rajak)UML (Hemant rajak)
UML (Hemant rajak)hrajak5
 
20BCT23 – PYTHON PROGRAMMING.pptx
20BCT23 – PYTHON PROGRAMMING.pptx20BCT23 – PYTHON PROGRAMMING.pptx
20BCT23 – PYTHON PROGRAMMING.pptxgokilabrindha
 
Apdm 101 Arc Gis Pipeline Data Model (1)
Apdm 101 Arc Gis Pipeline Data Model  (1)Apdm 101 Arc Gis Pipeline Data Model  (1)
Apdm 101 Arc Gis Pipeline Data Model (1)David Nichter, GISP
 
MathWorks Interview Lecture
MathWorks Interview LectureMathWorks Interview Lecture
MathWorks Interview LectureJohn Yates
 
VMworld 2013: Deep Dive into vSphere Log Management with vCenter Log Insight
VMworld 2013: Deep Dive into vSphere Log Management with vCenter Log InsightVMworld 2013: Deep Dive into vSphere Log Management with vCenter Log Insight
VMworld 2013: Deep Dive into vSphere Log Management with vCenter Log InsightVMworld
 
FP Days: Down the Clojure Rabbit Hole
FP Days: Down the Clojure Rabbit HoleFP Days: Down the Clojure Rabbit Hole
FP Days: Down the Clojure Rabbit HoleChristophe Grand
 
Kelis king - introduction to software design
Kelis king -  introduction to software designKelis king -  introduction to software design
Kelis king - introduction to software designKelisKing
 
Chapter 2 - Basic Elements of Java
Chapter 2 - Basic Elements of JavaChapter 2 - Basic Elements of Java
Chapter 2 - Basic Elements of JavaAdan Hubahib
 
II B.Sc IT DATA STRUCTURES.pptx
II B.Sc IT DATA STRUCTURES.pptxII B.Sc IT DATA STRUCTURES.pptx
II B.Sc IT DATA STRUCTURES.pptxsabithabanu83
 

Similar to 2018 07-ballerina-ballerina con (20)

Revolutionise your Machine Learning Workflow using Scikit-Learn Pipelines
Revolutionise your Machine Learning Workflow using Scikit-Learn PipelinesRevolutionise your Machine Learning Workflow using Scikit-Learn Pipelines
Revolutionise your Machine Learning Workflow using Scikit-Learn Pipelines
 
Data structure and algorithm.
Data structure and algorithm. Data structure and algorithm.
Data structure and algorithm.
 
Diksha sda presentation
Diksha sda presentationDiksha sda presentation
Diksha sda presentation
 
UML (Hemant rajak)
UML (Hemant rajak)UML (Hemant rajak)
UML (Hemant rajak)
 
OODPunit1.pdf
OODPunit1.pdfOODPunit1.pdf
OODPunit1.pdf
 
C++ Basics
C++ BasicsC++ Basics
C++ Basics
 
chapter 5.ppt
chapter 5.pptchapter 5.ppt
chapter 5.ppt
 
lecture_3.ppt
lecture_3.pptlecture_3.ppt
lecture_3.ppt
 
20BCT23 – PYTHON PROGRAMMING.pptx
20BCT23 – PYTHON PROGRAMMING.pptx20BCT23 – PYTHON PROGRAMMING.pptx
20BCT23 – PYTHON PROGRAMMING.pptx
 
Apdm 101 Arc Gis Pipeline Data Model (1)
Apdm 101 Arc Gis Pipeline Data Model  (1)Apdm 101 Arc Gis Pipeline Data Model  (1)
Apdm 101 Arc Gis Pipeline Data Model (1)
 
Data structure Unit-I Part A
Data structure Unit-I Part AData structure Unit-I Part A
Data structure Unit-I Part A
 
MDE in Practice
MDE in PracticeMDE in Practice
MDE in Practice
 
MathWorks Interview Lecture
MathWorks Interview LectureMathWorks Interview Lecture
MathWorks Interview Lecture
 
VMworld 2013: Deep Dive into vSphere Log Management with vCenter Log Insight
VMworld 2013: Deep Dive into vSphere Log Management with vCenter Log InsightVMworld 2013: Deep Dive into vSphere Log Management with vCenter Log Insight
VMworld 2013: Deep Dive into vSphere Log Management with vCenter Log Insight
 
Streams in Java 8
Streams in Java 8Streams in Java 8
Streams in Java 8
 
FP Days: Down the Clojure Rabbit Hole
FP Days: Down the Clojure Rabbit HoleFP Days: Down the Clojure Rabbit Hole
FP Days: Down the Clojure Rabbit Hole
 
Verilog
VerilogVerilog
Verilog
 
Kelis king - introduction to software design
Kelis king -  introduction to software designKelis king -  introduction to software design
Kelis king - introduction to software design
 
Chapter 2 - Basic Elements of Java
Chapter 2 - Basic Elements of JavaChapter 2 - Basic Elements of Java
Chapter 2 - Basic Elements of Java
 
II B.Sc IT DATA STRUCTURES.pptx
II B.Sc IT DATA STRUCTURES.pptxII B.Sc IT DATA STRUCTURES.pptx
II B.Sc IT DATA STRUCTURES.pptx
 

More from Sanjiva Weerawarana

Free & Open Source Software and Intellectual Property
Free & Open Source Software and Intellectual PropertyFree & Open Source Software and Intellectual Property
Free & Open Source Software and Intellectual PropertySanjiva Weerawarana
 
Service Oriented Architecture for Net Centric Operations based on Open Source...
Service Oriented Architecture for Net Centric Operations based on Open Source...Service Oriented Architecture for Net Centric Operations based on Open Source...
Service Oriented Architecture for Net Centric Operations based on Open Source...Sanjiva Weerawarana
 
Convergence in Enterprise IT ... the renaissance period
Convergence in Enterprise IT ... the renaissance periodConvergence in Enterprise IT ... the renaissance period
Convergence in Enterprise IT ... the renaissance periodSanjiva Weerawarana
 

More from Sanjiva Weerawarana (10)

Free & Open Source Software and Intellectual Property
Free & Open Source Software and Intellectual PropertyFree & Open Source Software and Intellectual Property
Free & Open Source Software and Intellectual Property
 
2013-03-JavaColomboMeetup.pptx
2013-03-JavaColomboMeetup.pptx2013-03-JavaColomboMeetup.pptx
2013-03-JavaColomboMeetup.pptx
 
2018 12-kube con-ballerinacon
2018 12-kube con-ballerinacon2018 12-kube con-ballerinacon
2018 12-kube con-ballerinacon
 
2016 07-28-disrupt asia
2016 07-28-disrupt asia2016 07-28-disrupt asia
2016 07-28-disrupt asia
 
2018 05-sri-lanka-first-harvard
2018 05-sri-lanka-first-harvard2018 05-sri-lanka-first-harvard
2018 05-sri-lanka-first-harvard
 
2017 09-07-ray-wijewardene
2017 09-07-ray-wijewardene2017 09-07-ray-wijewardene
2017 09-07-ray-wijewardene
 
Wso2 Cloud Public 2009 11 16
Wso2 Cloud Public 2009 11 16Wso2 Cloud Public 2009 11 16
Wso2 Cloud Public 2009 11 16
 
State Of Services
State Of ServicesState Of Services
State Of Services
 
Service Oriented Architecture for Net Centric Operations based on Open Source...
Service Oriented Architecture for Net Centric Operations based on Open Source...Service Oriented Architecture for Net Centric Operations based on Open Source...
Service Oriented Architecture for Net Centric Operations based on Open Source...
 
Convergence in Enterprise IT ... the renaissance period
Convergence in Enterprise IT ... the renaissance periodConvergence in Enterprise IT ... the renaissance period
Convergence in Enterprise IT ... the renaissance period
 

Recently uploaded

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 

Recently uploaded (20)

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 

2018 07-ballerina-ballerina con

  • 1. Ballerina is not Java (or Go or ..) Sanjiva Weerawarana, Ph.D. Founder, Chairman & Chief Architect; WSO2 BallerinaCon – San Francisco, July 18, 2018
  • 2. Motivation: Why yet another language? • Digital transformation – Everything is a network service – Produce, not just consume network services – Every business has to become a software company • Minimalization of computing – Hardware  VMs  Containers  Serverless – SOA  Microservices – ESB  Service meshes • Middleware is dead; middleware is everywhere – Servers  sidecars  code 7/21/2018 2
  • 3. Design motivation: Sequence diagrams • Used to describe how complex systems work • Why not use that as the abstraction for code? 7/21/2018 3
  • 4. Design principles • Code with equivalent both text and graphic syntaxes • Do not try to hide the network • First class support for network data types • Make programs network resilient by default • No room for best practices or “findbugs” • Make programs secure by default • No dogmatic programming paradigm • Mainstream concepts & abstractions, not research 7/21/2018 4
  • 5. Unusual aspects of Ballerina • Structural type system with network friendly types and unions • First-class nature of application level network abstractions • Graphical with sequence diagrams • Sequence diagram based parallelism model • Errors and exceptions • Traditional middleware is in the language – API mgmt, ESB like integration, data integration, streaming analytics, identity • Language extensibility with environment binding and compilation extensibility • Integrated query and streaming query • Language level security abstractions • Event driven runtime • Not afterthoughts: – Documentation – Version management – Dependency management – Testing 7/21/2018 5
  • 6. Values • Simple values: (), boolean, int, float, decimal, string • Structured values: tuple, array, map, record, table, xml, error • Behavioral values: function, future, object, stream, typedesc 7/21/2018 6
  • 7. Simple values 7/21/2018 7 10, 98 0 100.98 10.0 100.980 “would” “wouldn’t” true false string decimal float int boolean ()
  • 8. Structured values 7/21/2018 8 {{“x”: y, “a”: 20}, {“foo”: “bar”}, …} {[10, “20”], (“x”, 20, true), ...} mappings lists { ...} tables { ...} errors {<f>1</f>, <a>b</a>, …} xml
  • 9. Behavioral values • function • future • object • stream • typedesc • (few more coming) 7/21/2018 9
  • 10. Type descriptors • A type descriptor describes a set of values – Membership test for a set • A type is a label for the set • Note: a given value can be in any number of sets 7/21/2018 10
  • 11. Basic types • Names for the fundamental value sets – int, float, … • Type constructors – map, record, … 7/21/2018 11
  • 12. Broad vs. narrow type string s = “x”; • What type is the value “x”? – Narrow type: Singleton type with just that value: { “x” } – Broad type: string 7/21/2018 12
  • 13. Mapping types • Mappings are collections of (name, value) pairs • Variations – Open vs. closed mappings – Required vs. optional fields • “record” type constructor – Collection of mandatory and optional named fields of any types – Open if desired • “map” type constructor – Any fields but all values of a single type – Always open • Covariant subtypes – Storage type 7/21/2018 13
  • 14. List types • Ordered sequence of values • Variations: fixed length vs. variable length • Array constructor – Single member type – Fixed or variable length • Tuple constructor – Sequence of values of various member types – Fixed length 7/21/2018 14
  • 15. XML • Minimalistic but powerful native xml type • Non-traditional XML architecture – xml is sequence of things that appear in XML (elements, comments, text, ..) – Elements do not contain references to parent or siblings and same element can appear in multiple xml values – No node identity, no text nodes (just strings) – Namespaces married to Ballerina qualified name architecture • Literal XML values, reading/writing 7/21/2018 15
  • 16. Tables • Tabular data – Programmatically generated & manipulated – Database connectors to load/store tables • Integrated SQL-like query, ala C# LINQ – In-memory database – Table rows are just records (no ORM) 7/21/2018 16
  • 17. Errors • Errors are their own value space – (reason (string), details (map), stacktrace) 7/21/2018 17
  • 18. Other types • Unions • Finite types • Optional • json • byte • any 7/21/2018 18
  • 19. Union types • Type defined by union of two or more other types – Remember, a type is name for a set of values • E.g.: type IntOrString float | string; IntOrString v1 = “yo”; IntOrString v2 = 3.141592; 7/21/2018 19 0 100.98 “would” “wouldn’t”
  • 20. Finite types • Remember, a type is name for a set of values • Sets can have finite number of values as well type ThisOrThat “this” | “that” | 17; 7/21/2018 20
  • 21. Optional types • Variable can be declared to holding a value of a particular type or no value at all int? foo; Person? bar; • No null pointers in Ballerina! 7/21/2018 21
  • 22. json • json is just a union – () | int | float | string | map<json> | json[] • json objects are most commonly used – map<json>, but subtyped to an open record with non-mandatory fields in most cases – Very useful for man-in-the-middle network scenarios • With json being within the type system, no data binding concept needed for json 7/21/2018 22
  • 23. byte • Just a predefined union: type byte 0 | 1 | … | 255; • We avoid all the problems of different kinds of math for different numeric sizes 7/21/2018 23
  • 24. any • Predefined name for union of all built-in and user-defined types 7/21/2018 24
  • 25. Casting and conversions • Casting is defined by set membership: if the value is a member of the L-Value type then it can be casted, otherwise no – Value doesn’t change (of course) • ZERO automatic conversions – Not even int -> float • Future: data transformation constructs 7/21/2018 25
  • 26. Type matching • Union typed expressions have to be separated out before use: match expression { pattern [var] => statement; pattern [var] => statement; .. } • Or within an expression: expression but { pattern [var] => expression } 7/21/2018 26
  • 27. Errors and error lifting • Errors are its own value space • Can be returned or thrown – Often returned as T | error – Throwing is discouraged and meant to be used rarely • Error lifting – Many functions return ResultType | error – Check expression: check expression • If error return immediately, else error is eliminated from type set 7/21/2018 27
  • 28. Nil & error lifting navigation • Navigating deep hierarchies is common in integration code • Navigating through optional types are nil-lifted by “.” operator: a.b.c • Navigation is both nil and error lifted by “!” operator: a!b!c • Why? – Combination of optional types and type matching makes it impossible to have a null reference in Ballerina – Nil & error lifting make those rules palatable 7/21/2018 28
  • 30. Endpoints • Endpoints represent network termination points for incoming network interactions or outgoing network interactions plus set of typed interactions that are allowed • Ingress vs. egress endpoints • Egress endpoints represent remote systems – Offer a set of actions for interaction with them • Ingress endpoints are network entry points to a Ballerina runtime via a registered service – Calls are delivered to a particular resource in a service – Offers incoming endpoint list of actions to reply/message • Modeled as an actor in sequence diagram 7/21/2018 30
  • 31. Network interactions • Programmer needs to be made aware that this is a network call – Graphically line from a worker to an endpoint – Textually: var result = epName->actionName (args); • If any errors occur they need to be type matched and handled 7/21/2018 31
  • 32. Outbound resiliency • Failure is normal in network interactions • Endpoints are logical – Group them for load balancing, failover or other behaviors • Circuit breaking, bulk-heading, timeouts, load management all part of endpoint architecture 7/21/2018 32
  • 33. Services & resources • Service is a collection of resources where each resource is network invokable via ingress endpoints • Services must be attached to an endpoint to be invoked • Responses must be via endpoint and not by returning values – Responses may not go 7/21/2018 33
  • 34. Ballerina graphical notation • Sequence diagrams focused on showing worker and endpoint interactions – Endpoints represent network services • Each worker is sequential code – We can zoom in graphically but its really just code • Not meant to be used for low-code / no-code or by non- programmers – Meant to make it easier to understand complex distributed interactions 7/21/2018 34
  • 35. Always-on parallelism • Every executable entity (function, method, resource) is a collection of workers – Line in a sequence diagram • Each worker is a independent execution context • All workers of a function execute concurrently when the function is called 7/21/2018 35
  • 37. Blocking function invocation • Protocol – Initialization: start endpoints – Start concurrent workers – First one to return will release caller • Others continue to completion • If no one completes (e.g. due to failures) function call fails with “call failed” exception • Results in a cactus stack instead of a traditional call stack 7/21/2018 37
  • 38. Non-blocking invocation and futures • Any function can be called in a non-blocking way: future<T> f = start functionName (args) • Wait for completion, cancel, get return values via typed future 7/21/2018 38
  • 39. Worker to worker communication • Via anonymous channels, non-blocking for send, blocking for receive • More comprehensive patterns coming 7/21/2018 39
  • 40. Implementation • Compiler produces mid level intermediate representation (BVM bytecodes) into library (.balo) – Portable object format • Extensible architecture for compiler to allow 3rd party annotation processing to become part of compilation process, e.g. Docker/K8s • IDEs supported via Language Server Protocol – Plugins for VS Code, IntelliJ and standalone browser-based Composer • Current runtime is a Java based interpreter for mid level IR – Will be compiled via LLVM to native code 7/21/2018 40
  • 41. Ongoing work • Concurrency management with STM, uniqueness types • Workflow related – Forward recoverability – Compensation – Checkpoint and restart • Docker / Kubernetes compositions • Generic types • Internationalizing the grammar • Implementation – Native compilation via LLVM – Also WebASM 7/21/2018 41
  • 42. Summary • Ballerina is an attempt to build a modern industrial grade programming language – For future with lots of network endpoints • Type system is designed to make network data processing easier • First class network services along with functions/objects • Framework to encourage more secure code • Fully open source and developed openly 7/21/2018 42

Editor's Notes

  1. Talk about union and optional