40

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?
0

4 Answers 4

30
  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.

1
  • Does the ballerina support for Reactive Programming? Commented Sep 6, 2020 at 14:05
15

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.

7
  • 2
    It should be ballerina run main <package_path> Commented Feb 21, 2017 at 6:26
  • 2
    Will there be a formal 'Ballerina reference' in the future?
    – Jan
    Commented Feb 21, 2017 at 10:36
  • 4
    Is it based on Java?
    – Asif Patel
    Commented Feb 21, 2017 at 18:03
  • 4
    Ballerina language has been written using java. But it is a completely new programming language built from scratch. It has been inspired from the modern programming languages (Go) as well as widely accepted programming languages (Java, Python, C). Commented Feb 27, 2017 at 14:36
  • 2
    Current version of the Ballerina language spec can be found from github.com/sanjiva/ballerina/tree/master/docs/specification Commented Feb 28, 2017 at 4:36
11

Yes that's exactly the intent - Ballerina will come with a good understanding of what it means to write distributed interactions that are expected to perform well, act reliably and resiliently and work securely.

We hadn't thought about event streams for connectors to support Hystrix dashboard but will do!

10

First class representation for a service and actors is great making it optimal for integration. But from a developer point of view — these are just abstractions that you can easily implement in a reusable manner in any modern language. So at first it might not seem like a big deal. But if you look closer, ballerina is not only providing these abstractions OOTB — but also taking care of things like performance so that developers don’t have to worry about these things. Notably things like HTTP connection pooling, streaming and a whole lot more. Spring for instance does not provide connection pooling in their RestTemplate OOTB and most often developers don’t worry about this until their application is performing really badly.

Ballerina should provide OOTB or enforce all best practices for integration as is marketed and I'm hoping more of these best practices will be added in particular circuit breaker. It would also be great if we can get event streams for connectors so that netflix's hystrix dashboard can be used for monitoring.

Not the answer you're looking for? Browse other questions tagged or ask your own question.