Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Ballerina differ from other languages?

Ballerina is a general purpose, concurrent and strongly typed programming language with both textual and graphical syntaxes for better integration

  1. Is Ballerina an interpreted language?
  2. How to build Ballerina programs? Do we need to set Ballerina Home or any other system variables?
  3. How Ballerina supports dependency management? Are there any recommended build tools?
  4. What kind of tasks are recommended to do with Ballerina? Is it only suitable to do a specific task such as integration of various system?
  5. Where can I find language specification and what are the supported types in Ballerina?
like image 239
Abimaran Kugathasan Avatar asked Feb 21 '17 04:02

Abimaran Kugathasan


People also ask

What language is ballerina?

Ballerina is an open source general-purpose programming language designed by WSO2 for cloud-era application programmers. The project started in 2015 by architects from WSO2 as a code-based alternative to the configuration-based integration tools such as EAI, ESB, and workflow products.

What is ballerina programming used for?

Ballerina language is an open-source, cloud-native programming language designed to ease the burden of integration development associated with enterprise applications. Ballerina simplifies how a program talks over the network, usually to an application program interface (API).


2 Answers

  1. Is Ballerina an interpreted language?

Ballerina is a compiled programming language. It compiles to a platform-neutral binary form which is then interpreted by the Ballerina runtime.

  1. How to build Ballerina programs? Do we need to set Ballerina Home or any other system variables?

There is no system variable concept when it comes to Ballerina. Download and install the OS-specific installer from https://ballerina.io/downloads/

Running Ballerina programs

Use ballerina run command to compile and run Ballerina programs.

$ ballerina run hello.bal
Hello, World!

Use ballerina build command to produce a statically-linked executable binary with the extension "balx". Then use ballerina run command to run the program.

$ ballerina build hello.bal
$ ls 
hello.bal hello.balx
$ ballerina run hello.balx
Hello, World!
  1. How Ballerina supports dependency management? Are there any recommended build tools?

A Ballerina program usually consists of multiple Ballerina packages. A package is a collection of source files. It defines a namespace and the symbols in all the source files in the package belong to that namespace. If you want to refer to a symbol defined in another package, you need to first import that package, then you can refer to the symbol with the package name.

When you want to execute or build a Ballerina program, Ballerina resolves all your import packages using your program directory, built-in repository (Ballerina distribution contains all the core library package as well as some third-party connector packages ), or the Ballerina repository directory. Ballerina repository is the local repository available in your machine.

We will develop tools for you to manage the Ballerina repository in the future.

like image 115
Sameera Jayasoma Avatar answered Oct 07 '22 19:10

Sameera Jayasoma


Does Ballerina an interpreted language?

Ballerina is compiled and then interpreted.

How to build Ballerina programs? Do we need to set Ballerina Home or any other system variables?

You can use a text editor that you prefer or some IDEs (currently baallerina supports vim,IDEA,sublime Text3,VCS and atom) to write you ballerina program. When you have the source bal file. You can either package that as an archive (library, service or main) or simply run the single bal file. e.g. ballerina run main <path to bal path> (or you can give the path to archive) or ballerina run service <path to archibe (or you can give the path to archive .bsz)>

You don't have to set Ballerina home. It will be set by the ballerina itself. But you need to set the JAVA_HOME

How Ballerina supports dependency management? Are there any recommended build tools?

It is pretty much similar to Go language, refer the documentation for more info.

What kind of tasks are recommended to do with Ballerina? Is it only suitable to do a specific task such as integration of various system?

If your program contains about 80% or more of integration scenarios, then Ballerina would be a great candidate to try. But if the integration portion is pretty much less (< 20%) then you can think of something else. If the portion vary then you can decide based on your use case.

Where can I find language specification and what are the types supported in Ballerina?

Please refer Github location and Ballerinalang for more information.

like image 15
Thusitha Thilina Dayaratne Avatar answered Oct 07 '22 19:10

Thusitha Thilina Dayaratne