SlideShare a Scribd company logo
Ballerina: A modern programming
language focused on integration
Sanjiva Weerawarana, Ph.D.
Lead Ballerina
Founder & Chairman, WSO2
Overview
• Motivation
• Key differences
• Type system
• Errors
• Concurrency
• Networking
• And more
• Beyond the language
• Standard library, developer tools, testing, documentation, observability
Motivation: Why yet another language?
• Digital transformation
• Everything is a network service
• Produce, not just consume network services
• Minimalization of computing
• Hardware: Bare metal  VMs  Containers  Serverless
• Application architecture: SOA  Microservices  Functions
• Integration: ESB  Service meshes
• Middleware is dead; middleware is everywhere
• Servers  sidecars  code
New language
• Most widely used languages fall into one of the two ends of the spectrum
• Too rigid: Statically but nominally typed, often object oriented like Java, C#, Go
• Too flexible: Dynamic languages with little or no static typing like Python,
Javascript (but improved with Typescript), PHP
• Focus is not on the problems that are clear and present today
• Ballerina sits in the middle with
• Structural, mostly static strong typing
• Blend of functional, imperative and object orientation
• Strong focus on data oriented programming, network awareness
• Concurrency made simple for normal programmers
Design inspirations
• Sequence diagrams the core conceptual model for programming
• Many existing languages, including Java, Go, C, C++, Rust, Kotlin, Dart,
Typescript, Javascript, Flow, Swift, RelaxNG, Midori, DLang and more
Design principles
• Code with equivalent both text and graphic syntaxes
• Embrace the network with network friendly data types, resiliency and
syntax
• Make programs secure by default
• Little room for best practices or “findbugs”
• No dogmatic programming paradigm
• Familiarity, where appropriate
• Easy for non-rocket scientist programmers
• Mainstream concepts & abstractions, not research
Status
• Core language design getting closer to being done
• What I am explaining today is a mixture of what is available for download and
what is pending implementation
• Core language is stable but a few more breaking changes are coming 
• Implementation
• Core language
• Stdlib
• Tools
• Team
• 50+ engineers for last 2+ years with higher bursts
Hello, World main
% ballerina run hello.bal KubeCon
Hello, World main
Hello, World service
$ ballerina run helloservice.bal
Initiating service(s) in 'helloservice.bal'
[ballerina/http] started HTTP/WS endpoint 0.0.0.0:9090
Type system
Universe of values
• Simple
• (), boolean, int, float, decimal, string
• Structured: create new values from simple values
• Lists (arrays & tuples), mappings (maps & records), tables, xml and errors
• Behavioral: bits of Ballerina programs as values
• Functions, futures, objects, services and typedesc
• Streams(*), channels(*)
Values and storage
• Some values are stored only conceptually
• E.g. 3.1415 is a float value that doesn’t have a material “storage” location
• Simple values are always immutable
• Certain values are stored somewhere and that location is how you
identify the value
• Reference values
• All structured values and behavioral values
Types and type descriptors
• Types are names for type descriptors
• Type descriptors describe a set of value that belong to that type
• Do not add new values to universe
• Membership
• Given value can be in any number of sets, therefore have any number
of types
Types and shapes
• Values have a storage location (thereby another identity) and are
sometimes mutable
• Types only worry about ”shape” of a value
• Different basic types have different shapes
• Ignores storage location and mutability
• Only difference for reference values, not for simple values (as no storage)
• Type = set of shapes
• Subtype = subset
Types, values & shapes
• Value “looks like a type” at a particular point of execution if its shape
is in the type
• Value “belongs to a type” if it ”looks like a type” and no mutation can
change its shape so it no longer belongs to the type
Other type descriptors
• Singleton
• Union
• Optional
• any
• anydata
• byte
• json
any
• Describes type consisting of all values except error values
• Thus, any|error is a type descriptor for all values
anydata
• Type of all pure values other than errors
• Equal to:
• () | boolean | int | float | decimal | string | (anydata|error)[] |
map<anydata|error> | xml | table
• Used for message passing
byte
• Union of 0 | 1 | .. | 255
json
• Union of
• string | boolean | int | float | decimal | map<json> | json[] | ()
Errors
Error handling
• Different languages have different approaches
• Great blog by Joe Duffy on Midori error handling
• Two kinds of errors
• Abnormal errors (bugs)
• Normal errors
Abnormal vs. normal errors
• Abnormal errors
• Should not normally happen
• Little the programmer can do about them
• Normal errors
• Statically typed
• Explicit control flow
• Normal errors cannot implicitly become abnormal and vice-versa
panic/trap for abnormal errors
• Less convenient form than try-throw-catch
• Abnormal errors are not for people to play with!
• All other errors must be statically declared, even in concurrent
interactions
• Programmer must be aware and must handle
• Not allowed to ignore error returns with union typing
Concurrency
Making concurrency natural
• Most programming languages have made concurrency special
• Everything starts with one thing and then becomes concurrent
• Every executable unit (function, method, resource) is always
concurrent
• Collection of workers
• Sequence diagram with concurrent actors!
• Worker to worker communication allows coordination
Non-blocking runtime
• Ballerina does not rely on callbacks for high performance or scale
• User merrily programs as if they hold execution until delaying action
(I/O etc.) completes
• Runtime scheduler manages scheduling of ready to run strands to
threads
Strands
• Started by a worker or by starting a function call asynchronously
• “strand of workers”
• Gets scheduled to a thread for execution
• Represents a standard call stack
• Every named worker starts a new strand
• Represented by a future which can be used to get return value of
initial worker
Futures
• Futures represent strands
• Type is the return type of the worker running in the strand, including
any errors
• A named worker defines a variable of type future<T> where T is the
return type of the worker.
• Futures are first-class- so can be passed as parameters etc.
Communicating between workers
• Complex interactions allowed only when workers defined lexically
together
• Deadlock avoidance requires this
• Looking into session types to possibly strengthen this
• Values of type anydata|error can be communicated via cloning over
anonymous channels
• Errors (including panics) can propagate across workers
• Blocking & unblocking variants for send
Concurrency safety
• Use immutable data when possible
• Lock construct for explicit locking
• Implements two-phase locking
• Important: physical concurrency in business use cases is limited
• High concurrent users is the common scenario
• More work TBD for this area
• Uniqueness typing (Swift), Ownership types (Rust), STM, ..
• Ideal goal is Ballerina code will not fail with race conditions under load
Networking
Language abstractions
• BSD sockets
• Network communication is not just a byte stream!
• Messages, protocols, interaction patterns
• Endpoints are network termination points
• Inbound or ingress
• Outbound or egress
• Ballerina models these via Listeners, Clients and Services
Graphical representation
• Endpoints are represented as actors in the sequence diagram
• Usually Ingress endpoint on left, egress endpoints on right of workers
• Any network interaction shows up as a line to/from a worker to an
actor representing endpoint
Clients
• Clients are abstraction for egress endpoints
• Defined by an object with “remote” methods
• Methods with a “remote” qualifier
• Syntax:
• Text: var result = client->actionName (args);
• Graphically: line from worker to client
Outbound reliability & resiliency
• Fallacy of distributed computing: network is reliable
• Ballerina comes with library of tools to manage
• Load balancing
• Failover
• ..
• Implemented as libraries that layer on underlying clients
Listeners and services
• Listeners are responsible for establishing network ports (or other
concepts) and managing a set of services that are attached to them
• Listeners are objects that implement system interface
• Module listeners
• Listeners attached to module lifecycle
• Makes services equal citizens as main()
Services
• Collection of handlers for inbound requests
• Resource functions
• Listener responsible for dispatching requests to correct service and
resource
• Services are like singleton objects and are first class values
Service typing
• Listener to service relationship can be complex
• One listener can manage multiple service types, one service type can be
attached to different kinds of listeners
• Current service typing is done by extensions (annotations)
• WIP to improve
And more …
Yeah there’s a few more things ..
• Integrated LINQ-like query for table values
• Streaming query and stream processing
• Security abstractions for secure services and network data
• Distributed transactions, both ACID and compensating
• Long running execution support with checkpointing
• Language extensibility with environment binding and compilation
extensibility
Beyond the language
“Batteries included” standard library
• ballerina/auth
• ballerina/cache
• ballerina/config
• ballerina/crypto
• ballerina/file
• ballerina/grpc
• ballerina/h2
• ballerina/http
• ballerina/internal
• ballerina/io
• ballerina/jdbc
• ballerina/jms
• ballerina/log
• ballerina/math
• ballerina/mb
• ballerina/mime
• ballerina/mysql
• ballerina/reflect
• ballerina/runtime
• ballerina/sql
• ballerina/swagger
• ballerina/system
• ballerina/task
• ballerina/test
• ballerina/time
• ballerina/transactions
• ballerina/websub
Beyond code
• Editing & debugging
• VSCode and IntelliJ plugins
• Testing framework
• Observability: metrics, tracing, logging
• Documentation generation
• Modularity, dependencies, versions, building & sharing
Implementation
• Compilation process
• Mid level intermediate representation (BVM bytecodes) into library (.balo) as portable object
format
• Link & execute via multiple paths
• Link and execute in Java based interpreter (available now)
• Native binary via LLVM (in progress)
• WebASM, Android, embedded devices, MicroVM as future targets
• Bootstrapping compiler into Ballerina in (slow) progress
• 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
Compiler architecture
Conclusion
Ongoing work
• Concurrency safety
• Immutable types, STM, uniqueness types, ownership types
• Communication safety
• session types
• Workflow related
• Forward recoverability via checkpoint/restart
• Compensation
• Parametric typing
• Internationalizing the grammar
Timing
• Few more breaking changes expected but not anywhere as dramatic as
0.970, 0.980 or 0.990
• Thank you for your patience!
• Moving some features to ”Experimental” category for 1.0 timeframe
• 1.0 is expected by Summer(-ish) 2019
• Pretty much 3 years since birth
• Full native compilation of 1.0 will take longer
Summary
• Ballerina is building 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

More Related Content

What's hot

Using Scala for building DSLs
Using Scala for building DSLsUsing Scala for building DSLs
Using Scala for building DSLs
IndicThreads
 
Writing DSL's in Scala
Writing DSL's in ScalaWriting DSL's in Scala
Writing DSL's in ScalaAbhijit Sharma
 
Programming Languages #devcon2013
Programming Languages #devcon2013Programming Languages #devcon2013
Programming Languages #devcon2013Iván Montes
 
7 expressions and assignment statements
7 expressions and assignment statements7 expressions and assignment statements
7 expressions and assignment statements
Munawar Ahmed
 
What's the "right" PHP Framework?
What's the "right" PHP Framework?What's the "right" PHP Framework?
What's the "right" PHP Framework?
Barry Jones
 
.Net overviewrajnish
.Net overviewrajnish.Net overviewrajnish
.Net overviewrajnishRajnish Kalla
 
CH # 1 preliminaries
CH # 1 preliminariesCH # 1 preliminaries
CH # 1 preliminaries
Munawar Ahmed
 
6 data types
6 data types6 data types
6 data types
Munawar Ahmed
 
Reading Notes : the practice of programming
Reading Notes : the practice of programmingReading Notes : the practice of programming
Reading Notes : the practice of programming
Juggernaut Liu
 
Python's dynamic nature (rough slides, November 2004)
Python's dynamic nature (rough slides, November 2004)Python's dynamic nature (rough slides, November 2004)
Python's dynamic nature (rough slides, November 2004)
Kiran Jonnalagadda
 
Multilingual Site Building with Drupal 7 at Drupal Camp NYC 10
Multilingual Site Building with Drupal 7 at Drupal Camp NYC 10Multilingual Site Building with Drupal 7 at Drupal Camp NYC 10
Multilingual Site Building with Drupal 7 at Drupal Camp NYC 10
Suzanne Dergacheva
 
Programming language paradigms
Programming language paradigmsProgramming language paradigms
Programming language paradigms
Ashok Raj
 
Week 8 intro to python
Week 8   intro to pythonWeek 8   intro to python
Week 8 intro to pythonbrianjihoonlee
 
Multilingual Content: Presentation from DrupalCamp Montreal 2012
Multilingual Content: Presentation from DrupalCamp Montreal 2012Multilingual Content: Presentation from DrupalCamp Montreal 2012
Multilingual Content: Presentation from DrupalCamp Montreal 2012Suzanne Dergacheva
 
object oriented programming examples
object oriented programming examplesobject oriented programming examples
object oriented programming examples
Abdii Rashid
 
Persistent Data Structures And Managed References
Persistent Data Structures And Managed ReferencesPersistent Data Structures And Managed References
Persistent Data Structures And Managed References
Michael Galpin
 
Preparing for Scala 3
Preparing for Scala 3Preparing for Scala 3
Preparing for Scala 3
Martin Odersky
 
Ch6
Ch6Ch6
CISSP Prep: Ch 9. Software Development Security
CISSP Prep: Ch 9. Software Development SecurityCISSP Prep: Ch 9. Software Development Security
CISSP Prep: Ch 9. Software Development Security
Sam Bowne
 

What's hot (20)

Using Scala for building DSLs
Using Scala for building DSLsUsing Scala for building DSLs
Using Scala for building DSLs
 
Writing DSL's in Scala
Writing DSL's in ScalaWriting DSL's in Scala
Writing DSL's in Scala
 
Programming Languages #devcon2013
Programming Languages #devcon2013Programming Languages #devcon2013
Programming Languages #devcon2013
 
7 expressions and assignment statements
7 expressions and assignment statements7 expressions and assignment statements
7 expressions and assignment statements
 
What's the "right" PHP Framework?
What's the "right" PHP Framework?What's the "right" PHP Framework?
What's the "right" PHP Framework?
 
.Net overviewrajnish
.Net overviewrajnish.Net overviewrajnish
.Net overviewrajnish
 
CH # 1 preliminaries
CH # 1 preliminariesCH # 1 preliminaries
CH # 1 preliminaries
 
6 data types
6 data types6 data types
6 data types
 
Reading Notes : the practice of programming
Reading Notes : the practice of programmingReading Notes : the practice of programming
Reading Notes : the practice of programming
 
Python's dynamic nature (rough slides, November 2004)
Python's dynamic nature (rough slides, November 2004)Python's dynamic nature (rough slides, November 2004)
Python's dynamic nature (rough slides, November 2004)
 
Scala-Ls1
Scala-Ls1Scala-Ls1
Scala-Ls1
 
Multilingual Site Building with Drupal 7 at Drupal Camp NYC 10
Multilingual Site Building with Drupal 7 at Drupal Camp NYC 10Multilingual Site Building with Drupal 7 at Drupal Camp NYC 10
Multilingual Site Building with Drupal 7 at Drupal Camp NYC 10
 
Programming language paradigms
Programming language paradigmsProgramming language paradigms
Programming language paradigms
 
Week 8 intro to python
Week 8   intro to pythonWeek 8   intro to python
Week 8 intro to python
 
Multilingual Content: Presentation from DrupalCamp Montreal 2012
Multilingual Content: Presentation from DrupalCamp Montreal 2012Multilingual Content: Presentation from DrupalCamp Montreal 2012
Multilingual Content: Presentation from DrupalCamp Montreal 2012
 
object oriented programming examples
object oriented programming examplesobject oriented programming examples
object oriented programming examples
 
Persistent Data Structures And Managed References
Persistent Data Structures And Managed ReferencesPersistent Data Structures And Managed References
Persistent Data Structures And Managed References
 
Preparing for Scala 3
Preparing for Scala 3Preparing for Scala 3
Preparing for Scala 3
 
Ch6
Ch6Ch6
Ch6
 
CISSP Prep: Ch 9. Software Development Security
CISSP Prep: Ch 9. Software Development SecurityCISSP Prep: Ch 9. Software Development Security
CISSP Prep: Ch 9. Software Development Security
 

Similar to 2018 12-kube con-ballerinacon

David buksbaum a-briefintroductiontocsharp
David buksbaum a-briefintroductiontocsharpDavid buksbaum a-briefintroductiontocsharp
David buksbaum a-briefintroductiontocsharp
Jorge Antonio Contre Vargas
 
8. Software Development Security
8. Software Development Security8. Software Development Security
8. Software Development Security
Sam Bowne
 
CPP19 - Revision
CPP19 - RevisionCPP19 - Revision
CPP19 - Revision
Michael Heron
 
Introduction
IntroductionIntroduction
Introduction
baran19901990
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
Inductive Automation
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
Inductive Automation
 
8. Software Development Security
8. Software Development Security8. Software Development Security
8. Software Development Security
Sam Bowne
 
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
IndyMobileNetDev
 
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
Dave Fancher
 
ICONUK 2018 - Do You Wanna Build a Chatbot
ICONUK 2018 - Do You Wanna Build a ChatbotICONUK 2018 - Do You Wanna Build a Chatbot
ICONUK 2018 - Do You Wanna Build a Chatbot
Paul Withers
 
CSP: Huh? And Components
CSP: Huh? And ComponentsCSP: Huh? And Components
CSP: Huh? And ComponentsDaniel Fagnan
 
Open Source SQL Databases
Open Source SQL DatabasesOpen Source SQL Databases
Open Source SQL Databases
Emanuel Calvo
 
Reactive Development: Commands, Actors and Events. Oh My!!
Reactive Development: Commands, Actors and Events.  Oh My!!Reactive Development: Commands, Actors and Events.  Oh My!!
Reactive Development: Commands, Actors and Events. Oh My!!
David Hoerster
 
Unit 2 computer software
Unit 2 computer softwareUnit 2 computer software
Unit 2 computer software
Hardik Patel
 
FPL - Part 1 (Sem - I 2013 )
FPL - Part 1  (Sem - I  2013 ) FPL - Part 1  (Sem - I  2013 )
FPL - Part 1 (Sem - I 2013 ) Yogesh Deshpande
 
Class_X_PYTHON_J.pdf
Class_X_PYTHON_J.pdfClass_X_PYTHON_J.pdf
Class_X_PYTHON_J.pdf
SanjeedaPraween
 
Julia Computing - an alternative to Hadoop
Julia Computing - an alternative to HadoopJulia Computing - an alternative to Hadoop
Julia Computing - an alternative to Hadoop
Shaurya Shekhar
 

Similar to 2018 12-kube con-ballerinacon (20)

David buksbaum a-briefintroductiontocsharp
David buksbaum a-briefintroductiontocsharpDavid buksbaum a-briefintroductiontocsharp
David buksbaum a-briefintroductiontocsharp
 
8. Software Development Security
8. Software Development Security8. Software Development Security
8. Software Development Security
 
CPP19 - Revision
CPP19 - RevisionCPP19 - Revision
CPP19 - Revision
 
Introduction
IntroductionIntroduction
Introduction
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
8. Software Development Security
8. Software Development Security8. Software Development Security
8. Software Development Security
 
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
 
Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#Break Free with Managed Functional Programming: An Introduction to F#
Break Free with Managed Functional Programming: An Introduction to F#
 
c++
 c++  c++
c++
 
ICONUK 2018 - Do You Wanna Build a Chatbot
ICONUK 2018 - Do You Wanna Build a ChatbotICONUK 2018 - Do You Wanna Build a Chatbot
ICONUK 2018 - Do You Wanna Build a Chatbot
 
Voldemort Nosql
Voldemort NosqlVoldemort Nosql
Voldemort Nosql
 
CSP: Huh? And Components
CSP: Huh? And ComponentsCSP: Huh? And Components
CSP: Huh? And Components
 
Open Source SQL Databases
Open Source SQL DatabasesOpen Source SQL Databases
Open Source SQL Databases
 
Reactive Development: Commands, Actors and Events. Oh My!!
Reactive Development: Commands, Actors and Events.  Oh My!!Reactive Development: Commands, Actors and Events.  Oh My!!
Reactive Development: Commands, Actors and Events. Oh My!!
 
Unit 2 computer software
Unit 2 computer softwareUnit 2 computer software
Unit 2 computer software
 
FPL - Part 1 (Sem - I 2013 )
FPL - Part 1  (Sem - I  2013 ) FPL - Part 1  (Sem - I  2013 )
FPL - Part 1 (Sem - I 2013 )
 
Code Inspection
Code InspectionCode Inspection
Code Inspection
 
Class_X_PYTHON_J.pdf
Class_X_PYTHON_J.pdfClass_X_PYTHON_J.pdf
Class_X_PYTHON_J.pdf
 
Julia Computing - an alternative to Hadoop
Julia Computing - an alternative to HadoopJulia Computing - an alternative to Hadoop
Julia Computing - an alternative to Hadoop
 

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 Property
Sanjiva Weerawarana
 
2013-03-JavaColomboMeetup.pptx
2013-03-JavaColomboMeetup.pptx2013-03-JavaColomboMeetup.pptx
2013-03-JavaColomboMeetup.pptx
Sanjiva Weerawarana
 
2018 07-ballerina-ballerina con
2018 07-ballerina-ballerina con2018 07-ballerina-ballerina con
2018 07-ballerina-ballerina con
Sanjiva Weerawarana
 
2016 07-28-disrupt asia
2016 07-28-disrupt asia2016 07-28-disrupt asia
2016 07-28-disrupt asia
Sanjiva Weerawarana
 
2018 05-sri-lanka-first-harvard
2018 05-sri-lanka-first-harvard2018 05-sri-lanka-first-harvard
2018 05-sri-lanka-first-harvard
Sanjiva Weerawarana
 
2017 09-07-ray-wijewardene
2017 09-07-ray-wijewardene2017 09-07-ray-wijewardene
2017 09-07-ray-wijewardene
Sanjiva Weerawarana
 
Wso2 Cloud Public 2009 11 16
Wso2 Cloud Public 2009 11 16Wso2 Cloud Public 2009 11 16
Wso2 Cloud Public 2009 11 16
Sanjiva Weerawarana
 
State Of Services
State Of ServicesState Of Services
State Of Services
Sanjiva 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 period
Sanjiva 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 07-ballerina-ballerina con
2018 07-ballerina-ballerina con2018 07-ballerina-ballerina con
2018 07-ballerina-ballerina con
 
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

Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 
Nidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, TipsNidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, Tips
vrstrong314
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
abdulrafaychaudhry
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 

Recently uploaded (20)

Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 
Nidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, TipsNidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, Tips
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 

2018 12-kube con-ballerinacon

  • 1. Ballerina: A modern programming language focused on integration Sanjiva Weerawarana, Ph.D. Lead Ballerina Founder & Chairman, WSO2
  • 2. Overview • Motivation • Key differences • Type system • Errors • Concurrency • Networking • And more • Beyond the language • Standard library, developer tools, testing, documentation, observability
  • 3. Motivation: Why yet another language? • Digital transformation • Everything is a network service • Produce, not just consume network services • Minimalization of computing • Hardware: Bare metal  VMs  Containers  Serverless • Application architecture: SOA  Microservices  Functions • Integration: ESB  Service meshes • Middleware is dead; middleware is everywhere • Servers  sidecars  code
  • 4. New language • Most widely used languages fall into one of the two ends of the spectrum • Too rigid: Statically but nominally typed, often object oriented like Java, C#, Go • Too flexible: Dynamic languages with little or no static typing like Python, Javascript (but improved with Typescript), PHP • Focus is not on the problems that are clear and present today • Ballerina sits in the middle with • Structural, mostly static strong typing • Blend of functional, imperative and object orientation • Strong focus on data oriented programming, network awareness • Concurrency made simple for normal programmers
  • 5. Design inspirations • Sequence diagrams the core conceptual model for programming • Many existing languages, including Java, Go, C, C++, Rust, Kotlin, Dart, Typescript, Javascript, Flow, Swift, RelaxNG, Midori, DLang and more
  • 6. Design principles • Code with equivalent both text and graphic syntaxes • Embrace the network with network friendly data types, resiliency and syntax • Make programs secure by default • Little room for best practices or “findbugs” • No dogmatic programming paradigm • Familiarity, where appropriate • Easy for non-rocket scientist programmers • Mainstream concepts & abstractions, not research
  • 7. Status • Core language design getting closer to being done • What I am explaining today is a mixture of what is available for download and what is pending implementation • Core language is stable but a few more breaking changes are coming  • Implementation • Core language • Stdlib • Tools • Team • 50+ engineers for last 2+ years with higher bursts
  • 8. Hello, World main % ballerina run hello.bal KubeCon
  • 10. Hello, World service $ ballerina run helloservice.bal Initiating service(s) in 'helloservice.bal' [ballerina/http] started HTTP/WS endpoint 0.0.0.0:9090
  • 12. Universe of values • Simple • (), boolean, int, float, decimal, string • Structured: create new values from simple values • Lists (arrays & tuples), mappings (maps & records), tables, xml and errors • Behavioral: bits of Ballerina programs as values • Functions, futures, objects, services and typedesc • Streams(*), channels(*)
  • 13. Values and storage • Some values are stored only conceptually • E.g. 3.1415 is a float value that doesn’t have a material “storage” location • Simple values are always immutable • Certain values are stored somewhere and that location is how you identify the value • Reference values • All structured values and behavioral values
  • 14. Types and type descriptors • Types are names for type descriptors • Type descriptors describe a set of value that belong to that type • Do not add new values to universe • Membership • Given value can be in any number of sets, therefore have any number of types
  • 15. Types and shapes • Values have a storage location (thereby another identity) and are sometimes mutable • Types only worry about ”shape” of a value • Different basic types have different shapes • Ignores storage location and mutability • Only difference for reference values, not for simple values (as no storage) • Type = set of shapes • Subtype = subset
  • 16. Types, values & shapes • Value “looks like a type” at a particular point of execution if its shape is in the type • Value “belongs to a type” if it ”looks like a type” and no mutation can change its shape so it no longer belongs to the type
  • 17. Other type descriptors • Singleton • Union • Optional • any • anydata • byte • json
  • 18. any • Describes type consisting of all values except error values • Thus, any|error is a type descriptor for all values
  • 19. anydata • Type of all pure values other than errors • Equal to: • () | boolean | int | float | decimal | string | (anydata|error)[] | map<anydata|error> | xml | table • Used for message passing
  • 20. byte • Union of 0 | 1 | .. | 255
  • 21. json • Union of • string | boolean | int | float | decimal | map<json> | json[] | ()
  • 23. Error handling • Different languages have different approaches • Great blog by Joe Duffy on Midori error handling • Two kinds of errors • Abnormal errors (bugs) • Normal errors
  • 24. Abnormal vs. normal errors • Abnormal errors • Should not normally happen • Little the programmer can do about them • Normal errors • Statically typed • Explicit control flow • Normal errors cannot implicitly become abnormal and vice-versa
  • 25. panic/trap for abnormal errors • Less convenient form than try-throw-catch • Abnormal errors are not for people to play with! • All other errors must be statically declared, even in concurrent interactions • Programmer must be aware and must handle • Not allowed to ignore error returns with union typing
  • 27. Making concurrency natural • Most programming languages have made concurrency special • Everything starts with one thing and then becomes concurrent • Every executable unit (function, method, resource) is always concurrent • Collection of workers • Sequence diagram with concurrent actors! • Worker to worker communication allows coordination
  • 28. Non-blocking runtime • Ballerina does not rely on callbacks for high performance or scale • User merrily programs as if they hold execution until delaying action (I/O etc.) completes • Runtime scheduler manages scheduling of ready to run strands to threads
  • 29. Strands • Started by a worker or by starting a function call asynchronously • “strand of workers” • Gets scheduled to a thread for execution • Represents a standard call stack • Every named worker starts a new strand • Represented by a future which can be used to get return value of initial worker
  • 30. Futures • Futures represent strands • Type is the return type of the worker running in the strand, including any errors • A named worker defines a variable of type future<T> where T is the return type of the worker. • Futures are first-class- so can be passed as parameters etc.
  • 31. Communicating between workers • Complex interactions allowed only when workers defined lexically together • Deadlock avoidance requires this • Looking into session types to possibly strengthen this • Values of type anydata|error can be communicated via cloning over anonymous channels • Errors (including panics) can propagate across workers • Blocking & unblocking variants for send
  • 32. Concurrency safety • Use immutable data when possible • Lock construct for explicit locking • Implements two-phase locking • Important: physical concurrency in business use cases is limited • High concurrent users is the common scenario • More work TBD for this area • Uniqueness typing (Swift), Ownership types (Rust), STM, .. • Ideal goal is Ballerina code will not fail with race conditions under load
  • 34. Language abstractions • BSD sockets • Network communication is not just a byte stream! • Messages, protocols, interaction patterns • Endpoints are network termination points • Inbound or ingress • Outbound or egress • Ballerina models these via Listeners, Clients and Services
  • 35. Graphical representation • Endpoints are represented as actors in the sequence diagram • Usually Ingress endpoint on left, egress endpoints on right of workers • Any network interaction shows up as a line to/from a worker to an actor representing endpoint
  • 36. Clients • Clients are abstraction for egress endpoints • Defined by an object with “remote” methods • Methods with a “remote” qualifier • Syntax: • Text: var result = client->actionName (args); • Graphically: line from worker to client
  • 37. Outbound reliability & resiliency • Fallacy of distributed computing: network is reliable • Ballerina comes with library of tools to manage • Load balancing • Failover • .. • Implemented as libraries that layer on underlying clients
  • 38. Listeners and services • Listeners are responsible for establishing network ports (or other concepts) and managing a set of services that are attached to them • Listeners are objects that implement system interface • Module listeners • Listeners attached to module lifecycle • Makes services equal citizens as main()
  • 39. Services • Collection of handlers for inbound requests • Resource functions • Listener responsible for dispatching requests to correct service and resource • Services are like singleton objects and are first class values
  • 40. Service typing • Listener to service relationship can be complex • One listener can manage multiple service types, one service type can be attached to different kinds of listeners • Current service typing is done by extensions (annotations) • WIP to improve
  • 42. Yeah there’s a few more things .. • Integrated LINQ-like query for table values • Streaming query and stream processing • Security abstractions for secure services and network data • Distributed transactions, both ACID and compensating • Long running execution support with checkpointing • Language extensibility with environment binding and compilation extensibility
  • 44. “Batteries included” standard library • ballerina/auth • ballerina/cache • ballerina/config • ballerina/crypto • ballerina/file • ballerina/grpc • ballerina/h2 • ballerina/http • ballerina/internal • ballerina/io • ballerina/jdbc • ballerina/jms • ballerina/log • ballerina/math • ballerina/mb • ballerina/mime • ballerina/mysql • ballerina/reflect • ballerina/runtime • ballerina/sql • ballerina/swagger • ballerina/system • ballerina/task • ballerina/test • ballerina/time • ballerina/transactions • ballerina/websub
  • 45. Beyond code • Editing & debugging • VSCode and IntelliJ plugins • Testing framework • Observability: metrics, tracing, logging • Documentation generation • Modularity, dependencies, versions, building & sharing
  • 46. Implementation • Compilation process • Mid level intermediate representation (BVM bytecodes) into library (.balo) as portable object format • Link & execute via multiple paths • Link and execute in Java based interpreter (available now) • Native binary via LLVM (in progress) • WebASM, Android, embedded devices, MicroVM as future targets • Bootstrapping compiler into Ballerina in (slow) progress • 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
  • 49. Ongoing work • Concurrency safety • Immutable types, STM, uniqueness types, ownership types • Communication safety • session types • Workflow related • Forward recoverability via checkpoint/restart • Compensation • Parametric typing • Internationalizing the grammar
  • 50. Timing • Few more breaking changes expected but not anywhere as dramatic as 0.970, 0.980 or 0.990 • Thank you for your patience! • Moving some features to ”Experimental” category for 1.0 timeframe • 1.0 is expected by Summer(-ish) 2019 • Pretty much 3 years since birth • Full native compilation of 1.0 will take longer
  • 51. Summary • Ballerina is building 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