Ballerina - Role of modern programming language in cloud-native applications by Anupama Pathirage
Anupama Pathirage
Director/Head of Engineering - IntegrationReviews
Unleashing the Power of Ballerina in Cloud-Native Application Development
Welcome to our detailed exploration of the role of modern programming languages in cloud-native application development, featuring insights from the recent Women in Tech Go Global conference. Today's focus will be on Ballerina, an innovative open-source programming language designed to simplify the complexities of integration and application development in the cloud. Let’s dive into the world of cloud-native applications and how Ballerina streamlines this journey for developers.
Introduction to Cloud-Native Applications
Cloud-native application development is a transformative approach that fundamentally changes how software is built and deployed. While it's an established paradigm, there are numerous complexities that developers must navigate:
- Seamless Integration: Modern applications necessitate effortless connectivity across various services.
- Scalability: Applications must scale effectively to accommodate fluctuating traffic and load.
- Stability in Deployment: Consistent deployment strategies and environments are critical.
Anupama Pathirge, Director and Head of Engineering, highlighted the importance of understanding the lifecycle of software development, which includes planning, designing, coding, testing, releasing, and operating software. Navigating these stages involves multiple roles and presents unique challenges.
Challenges Developers Face
In application development, developers often encounter various challenges that impact productivity:
- Inconsistent Environments: Issues often arise when applications perform differently in production compared to local setups.
- Complex Onboarding: The complexity of applications can make it difficult for new developers to become productive quickly.
- Security Concerns: Managing security effectively is crucial.
- Tool Integration: The effectiveness of tools determines whether developers can work efficiently.
- Cloud Integration: Moving applications to the cloud can often disrupt productivity.
Introduction to Ballerina
Ballerina is a cloud-native programming language optimized for integration processes. Launched in February 2022, Ballerina aims to make developing cloud-native applications easier:
- Rich Ecosystem: Ballerina includes various services, data formats, and connectors for seamless integration.
- Built for Developers: It simplifies the complexities of integration-heavy applications by providing appropriate abstractions.
Key Features of Ballerina
Ballerina stands out with unique features that bolster developer efficiency:
- Right Abstractions: Ballerina reduces the inherent complexities in integration applications, allowing developers to focus on business logic rather than technical hurdles.
- Concurrency Safety: The language includes built-in mechanisms that help developers avoid common concurrency issues.
- Diverse Data Handling: With rich type systems and easy data transformation, Ballerina streamlines the communication process between different systems.
Visual Programming and Documentation
Ballerina supports both low-code and pro-code development through:
- Visual Diagrams: Automatic generation of diagrams from code enhances understanding and documentation.
- Flow Diagrams and Sequence Diagrams: These tools simplify the representation of system interactions.
AI-Assisted Development
Ballerina integrates advanced AI capabilities that enhance developer productivity:
- AI Copilot: Acting as a sidekick, this tool assists developers in coding and refining logic in real-time.
- Building AI Agents: Enables the creation of intelligent agents that seamlessly integrate with other systems.
Deployment Made Effortless
Deploying applications developed in Ballerina is straightforward:
- Self-Contained Executables: Developers can quickly generate JAR files using easy build commands.
- Cloud Compatibility: Ballerina allows for generating Docker images and Kubernetes artifacts effortlessly, making cloud deployment seamless.
Join the Ballerina Community
As an open-source project, Ballerina continues to grow thanks to its vibrant community. You’re invited to participate in:
- Tech talks and training sessions.
- University programs
Video Transcription
Hello, everyone. Thank you for joining women in tech women in tech go global conference and also today's session.Good morning, good evening, or good afternoon from wherever you are joining, and welcome to the session. In today's session, I'm going to discuss in detail about how, what is the role of modern programming language, especially in the cloud native application development. Although cloud native application development is not a new thing, there are certain things that we have to think of. There are certain complexities. So throughout my session, I'll go through some of these, and I will go through some demo, to showcase, some of the capabilities of Balearna. So first of all, I would like to introduce myself. I'm Anupama Pathirge, currently working as director and head of engineering for the integration.
And, WSU two is a software company. We specialize in middleware application development, especially like, integration, API management, identity and access management, and so on. And most importantly, we are working on open source software development. So with that, we are involving with lot of open source initiatives and activities as well. Having said that, I would like to join, I'd like to start the discussion with this image. Actually, this is an image that I generated using AI very quickly. Here, I wanted to showcase the complexities involved with the developers. So this is a typical application developers, typical you can see a typical application developer. But, beyond that application development, he has to think of many things now. Sometimes we might think, okay. It's not the responsibility of the application developer to think about those things.
But with with all these additional complexities, additional systems like deployment patterns, different architectures, infrastructures, it is not easy to completely be isolated with those things. So if you are working in IT or software development industry, you know how related they are. So underneath your or behind the scenes, you will have to deal with lot of complexities. So the journey from the core to cloud, that is what I'm going to discuss today mostly. The cloud native applications are not new. They have transformed the way that we are building and deploying our applications that makes the lives easy, but at the same time, there are certain complexities associated with them. So modern modern applications require seamless integration, and they need to scale rapidly. And, also, the develop deployment strategy should be very stable.
Like that, there are certain things that we have to think of. So in this this is a typical life cycle of software development that you can see. It involves with, planning initially, and then, we we design things, and then we build and develop the code, and then we test it, and then we release it. And finally, we deploy it. And after deploy, we had to operate it. And, where we deploy is something that we had to really think of based on the requirements of the application. And, also, how we operate is, depending on those factors and also we have to monitor. And finally, based on the monitoring stuff as well as the feedback improvement request, we need to adjust the application and prerelease. So that's a cycle.
So when we are working on this cycle, there are various different things that we had to do. So this is, that is a problem that we are facing, how to make the lives easy of the developers as well as the developer operations people. So it involves many, many roles, and, every day, people struggle or developers or the DevOps people are struggling because of many reasons. So if I summarize some of these, one thing is like inconsistent environment. Most of the time, we get the issues in the run time or the production environments, but the developers are facing, okay, okay, it works in my machine, and it's, why it is not working in the production environment? And also onboarding stuff, because the software applications are very complex. And, understanding maintainability of the code, All these things matters a lot.
Sometimes it takes days or two weeks to become productive, after understanding the complexities associated with the system. And also security is very big concern, how we handle the security and how flexible the system is to adjust things. Also, the tools, what are the different tools that we are using? Are they helping the developers to being productive? Or are they disconnected tools? How how they are interrelated? Those are very much important when we are working with software development process. And also finally the cloud to cloud stuff. That means how we can bring our application to the cloud, without killing the productivity. Most of the time, CICD flows automated, but the developer workflows are not fully automated. So, likewise, there are certain complexities associated in every stage of the process. So Ballerina is a technology, that is simplifying cloud integrations.
So I will explain what is that and how it is simplifying things in the upcoming slides. First of all, I would like to introduce what is Ballerina. It is an open source cloud native technology, which is optimized for integration. And I would say we started the effort in around 02/2016, and we released the first version first major version in February 2022. That is what we call Ballina Swan Lake version. And it really took time because in a way, we can think of it as a problem in language. So developing a problem in language, its compilers, its, libraries, and everything is taking time. So it has a rich ecosystem of different services, data formats, connectors so that it can seamlessly connect with various ecosystems.
And if we talk about the differences or why do we need another language, it has many different features if we compare with other languages. It has, full textual as well as graphical features where you can view or edit or continue your application development either textually or that means low code mode or graph pro code mode or graphically. That means low code mode. So and, also, it has many efficient concurrency mechanisms and, also, the diagramming capabilities makes it very maintainable and easy to understand. Concurrency safety plays a big role in the language development or the design. Likewise, there are many difference differences if we compare with other languages. So in high level, if you think where Ballina helps, it helps you to bring your code into the cloud very fast because integration developers lives made easy. If it is an integration heavy use case, Ballina is going to be an ideal choice of language because they are all the languages are having certain, strengths, weaknesses, and they are suitable for many different scenarios.
When it comes to Ballina, we are using it for integration heavy use cases. If you compare with any other language like Java, Go, c plus plus, we can do the same thing using Ballina. And even those languages can do same things Ballina can do. But when it comes to integration heavy or the applications which are having lot of integration key requirements, Ballerina make well, now provide a lot of abstractions and capabilities, tools, and everything to make it very simple. And also from code to cloud, you don't need to deal with the YAML, and it is all auto generated with many few simple steps. And it helps the developers or the DevOps, members to make it available to the deployments. And also, we don't have a lot of tools.
One tool which provides all the support and observability and security are part of the language. Those are the highlights that I would like to go through in this session. So So as I mentioned before, it's a programming language, but I would say it's more than just a programming language. It's a full framework. It is built on existing technologies, and it derive the capabilities of many existing languages. It's a CC plus plus family language. If you're familiar with Go, Java, and other languages, learning Balena is not a big deal. And also it's not a research project. It is something that we can use in the production environments. So what is the specialty? So I'd like to highlight three things here. Balena provides right abstractions. So the right level of abstraction, that means something which is natural to the problem is very important.
Let's say if you're writing integration application and if you had to deal with all the underneath complexities of creating a opening a port, opening a listener, writing a resource function, all these if the if you have to deal with all these complexities, you will spend time on those underneath complexities rather than solving your business problem.
So that's why we need clean and clear abstractions, which makes it easy for the integration application development. So there are three things that we are considering here. Data is one of the main thing because in integration applications, data is a key thing. We are, we are communicating with different systems using data. We we had to represent data. That means we had to think of the shape of the data, and we had to think of how we can separate it from the behavior or the, code, and also how we manipulate data, communicate data, how we transform data. All these things should be really easy. And the next thing is network because, we are communicating across the network. So that means there can be different types of protocols involved, different types of services, clients, or many different protocols are involving. So we have to handle all these things.
And the third thing is concurrency because integration applications are inherently concurrent. And if you have to deal with all the concurrency related problems, you know how hard it is to troubleshoot a concurrency related issue in the run time. So if the application or the program that you are developing can give you warnings or suggestions on where things can lead into concurrency related issue, it's a real advantage for the developers. So Malena has, concurrency safety mechanisms, which gives you warnings and other errors if you are developing an application in a way that it can lead into concurrency related issues. So those are the three things. So how we represent data? There are very rich type system which involves JSON XML, all also part of the primitive types and type representation as well as type transformation.
All these things are really easy. And the network abstraction services and clients are part of the language. That means to create a client or service of a certain type, it is just a matter of writing, few lines of code or use it in the visual form, and then the concurrency is handled by the language design itself. So these are some of the features. So you can see a diagram here. If the diagram is generated automatically from the code. Whether you are a pro code developer, whether you are very hard code developer, or if you are integration developer that you don't like to understand most of your programming language, deeper level things, still, both of the ends, this Balena will work because this is a diagram taken from the Versus code.
If you install the Balena Versus code plug in, it will give the capabilities to write the program like in any other language, or else it will generate the code diagram out of the code so that you can go ahead with the diagram by editing it, or updating the notes as needed. So that pro code, low code parity, we always maintain. The next thing is the documentation or the diagrams, which helps the maintainability of the code a lot. And, also, it improves the understandability. There are many different diagram types I will explain in the demo as well. One kind of diagram is a flow diagram, which shows how the instructions are happening in, like, a sequence. And also there is a sequence diagram mode of view as well. Sequence diagram view shows how the systems are interacting with each each other. For example, if you are explaining some integration related integration application to someone, what we do is we take a paper or we go to the whiteboard, and we draw the interactions in a way like a sequence diagram.
We call this system. We get this response, and then we do some processing, and then we work another system. Likewise, we explain things in a sequence diagram. So if you can get such a diagram out of your code without any effort, that's a real under advantage to understand the system, what it is doing. So Ballina has that capability. So you can see your die code as a flow diagram or a sequence diagram. And, also, at the same time, there are many other additional diagram types, like type diagram, service designers, and things like that, which helps you to, make it more easy for the application develop. So this is one one other thing I discussed, data transformations. Usually, when we receive some sort of data, some it comes in certain form, certain shape. That means certain fields, certain data types are there, and we need to convert it to completely different type.
By sometimes, we need to do some, calculations or manipulations in between, doing the transformation. So we had to do we can do it completely in the code as well as we can do it in the diagram level as well. So easy drag and drop kind of data mapping capabilities, Sandia. So whether you are getting adjacent and you if you want to connect it to XML by doing some manipulations in between or something like that, we can do very easily. And then debugging and testing. That is something that we can't forget if, in real application development because, debugging is very natural thing for any program in language. The difference is in Ballina, we have visual debugging as well.
Similar to normal programming debugging debug breakpoints, you can put a debug breakpoints into your diagram and start debugging, and you will see similar kind of debug information, if you do the visual side of the debugging as well. And I talked about protocols. Ballerina has native support for all these protocol, different type of network protocols. It makes you it makes it very easy to write services, clients, and other things using these protocols. And most importantly, it's not just a language. It comes with an ecosystem around it. Since we are targeting this language for integration application developers, that means we had to connect with various systems. It can be databases. It can be message brokers. It can be various SaaS applications. Likewise, we had to have a way to connect to all these things very easily. So we have more than 600 plus connectors, and also generating connectors based on open API specifications are very easy.
If you have a open API specification for your service, then, within a matter of seconds, we can generate a connector using Valena to open API tool, which takes open API file as a input, and it generates a connector, in well in our language for that to, specification. And the latest advancements, if you talk a little bit about it, AI assisted capabilities. We have AI assisted Copilot, which acts like a pair programming companion, side by side to a development window. You can give the prompts in the natural language, asking to generate certain things and, improve the code iteratively and add it to a logic. So AI Copilot is a kind of a game changer where it boosts the developer productivity, massively. And then the AI agents, it's something that we are talking all the time these days. Build and manage your AI agents is something really easy with Ballerina.
So you can do natural language prompts, to say that what the agent is supposed to do, and you can integrate it with different models, open AI models or whatever, Gen AI models. And then you can attach certain tools with that agent so that agent can perform its task by using these tools. So these tools can connect to the valid network connectors and then, do the agent can perform the chat task and return. These agents are not just the chat agents. They can stay in your integration application workflows as well, and then they can perform task and get back to you. So the final thing that I'm going to discuss is the deployment aspects. So how we are going to deploy an application developed using Balletna? So one way of doing that is to build a self self contained executable, which is a jar file.
You can use the bell build command to build it, and it will generate it, and you can use it. And then the next thing is how to deploy this in the cloud environments. Valverna is designed in a way that it allows the developers to write code without thinking about the deployment platform. So you can independently write the code, but at the same time, it simplifies experience of deployment because it enables or it provides various, capabilities to generate the deployment artifacts based on the environments. So first thing is, like, how we can build a Docker image. I will show in the demo as well. You can issue the bal build dash dash cloud equal docker command. It will generate all the docker artifacts for you. And same with Kubernetes, AWS, Lambda, and other things.
Once you issue the flag, correct, parameter, it will generate the artifacts for you. Then it's just a matter of, update the YAML files as needed and then deploy. So that means the ballerina, it extract the information out of your source code. It reads your source code. It understands semantics of the Ballina code and generate artifacts. And in this demo, I'll quickly this is a prerecorded demo. I will showcase a application, which is already developed using Ballerina, and this is Visual Studio Code Editor. I opened the application using Visual Studio Code Editor. What it does is it's a simple service. It is allowing you to select your music playlist based on the current weather. Let's say the current weather is sunny. First, that means you have to give a location to do your service. When you input a location, it will contact the weather API and get the weather information.
And based on the weather, if it is sunny or rainy, you will contact Spotify client asking give me playlist which is matching for this kind of weather condition. If it is runny sunny, you might need different, mode of playlist. If it is rainy, you might need relaxing or calming kind of playlist, things like that. So this is the view that you will see in your v s quality detail. So this is already developed application, but I'll explain certain things here. This is a high level design view of your application. And then, you can see there are default the listeners which listens on certain port, and this is the HTTP service. It has base path as music mode and place list as the get resource function, and it is connecting to two APIs with the API and Spotify API.
And then you can edit your service or web at any other function here. You can see this is the resource function, view. It has a flow diagram view as well as you can see the sequence diagram view. It connects to the weather API, get some response, and it calls a function to get the mode for a given weather weather and then call to the Spotify client. So you can see the application flow, how it interacts with different systems easily. And, also, you can view the source code. This is the source code generated for this code, diagram, the or this scenario. That is a ballerina code. I would like to, showcase certain things here. You can see listeners here and service types here, which is attached to a human listener. So service types, resource functions, those are fundamental things in the background.
That's what I talked about as the, network abstractions in the language. The service syntax, resource function syntax, listen syntax, those are part of the language. You don't have to deal with the underneath complexities when creating a service. What you have to focus on, creating a service, resource function, even the resource function signature is very much similar to normal function signature. You have a function keyword and the name of the function, return types, input parameters. Input parameters will work as query parameters here. Return types will work as return types of your resource. And then it is simply like writing a normal function. And since the underneath complexities are hidden by the network abstractions, what you have to focus only on the business logic that is a implementation of this function.
So that's the beauty of the syntax with the network abstraction. So you can create new constructs or you can modify. Here, I'm adding a simple if if condition to show it. So you can see the condition got added to the diagram side as well as if condition got added to the code side. So that is why we are maintaining the parity between the code and the diagram always. So you can edit in the record side even. Let's simply add as a simple variable. You can see the diagram is automatically generated. So that is, coming automatically with the plug in. You don't have to do anything. So the diagram is there all the time for any ballerina code that you are writing.
Or any diagram that you are developing in the visual view, you will get the corresponding code. So in the left side, you can see various construct entry points, listeners, which is associated with this application and especially the types. These types are, the record types in Ballina. You can see how they are interconnected. So when we have this view, it's very easy to understand how these things are related. It's very complex diagram if you have a lot of types interacting, but it is giving you very intuitive way to, understand the side type system interrelations. And the next thing is the data mapper. As I mentioned before, mapping data from one type to another type is very much important in the integration applications.
So the data mapper helps you to do that. This is a data mapper, which having large record in left side and very small record on the other side. So you can drag and drop the phase and in between you can add expressions to modify certain things, and then it will generate the auto mapping. And also there's auto mapping feature, which is AI based one. You don't need to do mapping by hand if you provide certain context if you have. And also it analyze existing fields, their types, and then it will do the mapping based on the input and output types. So this is very high level view of what Ballerina looks like, and here's a readme file of your application. And finally, we need to deploy. There are certain ways to deploy. Some tools are provided here, visual aids. But I'm going to use the terminal here just to show the things that I discussed earlier.
First thing is, like, if you issue bell build command, it will compile and build the source code, and it will generate the jar file. If you go to the target folder in the bin inside the bin, you can see the jar file. And the next thing is, like, if you issue bell build, dash dash cloud equal docker command, it will generate the docker artifacts, docker file for you with all the dependencies. You can see it's building the docker image. And once it is done, you will be able to find it within the, target inside the Docker folder. And similar to that, we can generate cloud, Kubernetes artifacts using the same command with Kubernetes as input. It will generate, artifacts, services, config max, and everything. It reaches our score. It analyze the ports and everything, resource parts, service parts, and generate the artifacts.
And, sometimes it, actually, it comes with memory and other parameters with the default values. If you really want to, add update those things, you can update here, or you can add a config file to update them, based on the configurations. So that is a demo. Actually, that showcase very high level view of what what Balena looks like, and it's actually free to use. You can download Balena from balena.au website. And, also, you can go to Versus code marketplace and download the plug ins there, and you can use it freely, because it's open source project. So we are having a rich open source community around us. So we would like to welcome you all to open source community of Ballina.
We conduct tech talks, trainings, university programs, and many other things. And if you visit ballina.i0 community page, you can see all of these things. And, and also we welcome, codecom contributions. We provide many hackathons, events related to the code, improvements as well as new features. So feel free to join with us, and thank you for joining today's session. And we'd love to see you, in Ballina Community Monday. Thank you.
No comments so far – be the first to share your thoughts!