How does Ballerina differ from other languages? - wso2

Ballerina is a general purpose, concurrent and strongly typed
programming language with both textual and graphical syntaxes for
better integration
Is Ballerina an interpreted language?
How to build Ballerina programs? Do we need to set Ballerina Home or
any other system variables?
How Ballerina supports dependency management? Are there any recommended
build tools?
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?
Where can I find language specification and what are the supported types in Ballerina?

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

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.

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!

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.

Related

How to build using ant in IBM RAD

All,
we have multiple applications that we develop in IBM RAD 7.5.
Since, RAD does build all the applications that are required, I was wondering how can I achieve the same using ant files.
What I wanted to know is apart from my application specific libraries (that I will know where they are etc), which other jar files should my application point to?
I am talking about IBM WAS runtime libraries etc, so that my application builds successfully.
Is there a standard guideline by IBM on this?
Thanks.
The JARs provided in WAS_HOME/dev/ in WebSphere Application Server 7.0 and later, such as was_public.jar or j2ee.jar, are intended specifically for this purpose.
#bkail's answer is probably what you want if you're on one of those more recent versions of WAS (I don't have v7 or v8 installation to verify).
Another option is to expand the Server Runtime library that you have added to your RAD Java Build Path, you'll see the jars you want to include for your Ant build.
However, if you're actually running within RAD, you'll be pointing to a full server runtime which contains more than you need to simply compile. In that case, you can add one of the "WebSphere Application Server vX stub" runtimes just to see which jars those include; they are the minimum for compiling.
Which specific jars are in that environment will depend on your version of WAS, any installed Feature Packs, and probably even Fixpack levels. In many cases - depending on which APIs you're using - all that's needed to compile is j2ee.jar.
(You probably already realize this, but remember that you only need those jars in your classpath to compile, you don't want to deploy them in your WAR since they're already part of WAS.)

Keeping dependency versions up to date in Leiningen projects

Is there a simple way to find out what versions of dependencies are available using Leiningen?
E.g., if I have a web app which depends on Hiccup and Compojure, how can I be sure that I'm on the latest version of each without going to the github page for each?
NOTE: I use Ant and Ivy for building my Java projects, so I have limited knowledge of Maven - so please spell out (or provide Fine Links for me to read) any Maven concepts that Leiningen exposes to me which would help with this (I know that under the hood, Leiningen uses Maven for dependency resolution). Ta.
The Clojure ecosystem has evolved since the original answer was offered. At the present time, I would recommend using lein-ancient:
A Leiningen plugin to check your project for outdated dependencies and plugins. This plugin supersedes lein-outdated and uses metadata XML files in the different Maven repositories instead of a Lucene-based search index. Version comparison is done using version-clj.
Its precursor, lein-outdated, has this helpful message in its README: "lein-outdated is outdated". :)
The canonical way of doing this, at least for dependencies kept in clojars, is the lein-search plugin.
Update: See the highest-rated answer below for a more up-to-date response.
You should have a look at the answer to this question. Leiningen uses the same versioning mechanism as maven so, for example, if you want to use the latest version of a given library, you can substitute the word "LATEST" for the version number. You can also specify a release version or a version range. Again, look at the answer at that link.
Web service that provides this info, along with badges for readmes.
http://clj-deps.herokuapp.com
Disclaimer, by me.

How do you distribute a Clojure program to non-programmers?

I'm new to Clojure but I'm learning it. I'd like to know the best way to package and distribute a Clojure program to end users who aren't necessarily programmers. I know in Ruby you can just tell users to download the program with gem install [program name] and then run the command that runs the program. What's the equivalent for Clojure programs?
I you use Leiningen it has an uberjar command to make self contained executable jar files, which your users can just double click. See: http://zef.me/2470/building-clojure-projects-with-leiningen
Clojars is great if you're distributing a library, but I'm not sure if that's the best option for end users.
If you're already using Maven, I believe the best option is to create a uberjar containing all required classes. If you want to make it even more end user friendly, you can then create an installer from this jar using something like IzPack. Just remember that Clojure programs are Java programs, so all distribution options for Java are valid for Clojure as well.
lein uberjar works great for small mostly-Clojure apps, but it doesn't scale when using many Java libraries, including necessary licenses, and other such things. If you use the Maven Clojure plugin, you could take advantage of the vast and terrifying Maven assembly plugin to build and final structure you might conceivably need.
Or you could write a Leiningen plugin to do something similar. I'm not sure if such a thing exists.
Clojars (http://clojars.org/) is the bigger repository of Clojure libraries you can find.
It works perfectly with Leiningen projects or any other Maven based project management tool.

Is there any Maven like tool that works for many languages?

I'm trying to find a tool like Maven (standardized build & packaging, artifact repo, etc) that supports more than Java (and C/C++), specifically Python and .NET (C#) as well. Especially good dependency management is desired.
We're running a mixed shop of languages at our place, and the current homegrown python-based "über-buildsystem" should probably go away. Note that it doesn't attempt to do detailed builds, just handles dependencies between modules/projects, downloads compiled artifacts (a few hundred megs per library in the C++ case) and invokes msbuild/easy_install/etc on the existing .sln/.vcproj/etc files to get the real build done.
It works, but mostly because I built it and know what it can and cannot do, and I extend it when I need new stuff. It's not really helping the other developers getting in to it, and I feel more and more that we shouldn't focus on that. (Even though it's not that much work and there doesn't seem to be a compelling alternative.)
So:
Python's setuptools only seem to be for Python (and some c++ -> .pyd compilation).
Maven mostly does Java, and some C/C++, mostly for JNI.
For C/C++ there is... nothing? (qmake/cmake for building)
For .NET there are some stuffs, but do they work well outside Visual Studio and the MSFT toolchain?
Building another Maven (but with more flexible support) on top of Ant (using Beanshell mostly) is something I've done already. The current Python-stuff is an offshoot of that.
Update:
Ant+Ivy would require building quite a bit on top, as I indicated above, but it's probably a better foundation than what we have today, since we get more build tasks and an artifact repo out of the box. (See Maven Like dependency management for C++)
All help warmly appreciated!
Try waf.

Release management system for Linux

What we need in our firm is a sort of release management tool for Linux/C++. Our products consist of multiple libraries and config files. Here I will list the basic features we want such system to have:
Ability to track dependencies, easily increase major versions of libraries whose dependencies got their major version increased. It should build some sort of dependency graph internally so it can know who is affected by an update.
Know how to build the products it handle. Either a specific build file or even better - ability to read and understand makefiles.
Work with SVN so it can check for new releases from there and does the build.
Generate some installers - in rpm or tar.gz format. For that purpose it should be able to understand the rpm spec file format.
Currently we are working on such tool which is already pretty usable. However I believe that our task is not unique and there should be some tool out there which does the job.
You should look into using a mix between Hudson, Maven (for build management), Ivy (for dependencies management) and Archiva (for artifacts archival).
Also, if you are looking into cross.compilation, take a look at Make Project Creator (MPC) and Bakefile.
Have fun!!
In the project I'm currently working on we use cmake and other Kitware tools to handle most of this issues for native code (C++). Answering point by point:
The cmake scripts handle the dependencies for our different projects. We have a dependency graph but I don't know if is a home-made script or it is a functionality that cmake provides.
Well cmake generates the makefiles regarding the platform. I generates projects for eclipse cdt and visual studio if it is asked to do so in case of developing.
Cmake has a couple of tools, ctest and cdash that we use to do the daily build and see how the test are doing.
In order to create the installer cmake has cpack. From just one script it can generate tar.gz, deb or rpm files in Linux or an automatically generated NSIS script to generate installers in windows.
For Java code we use maven and hudson that have been already mentioned here.
Take a look at this article from DDJ, in which a more robust build system concept (than make) is presented and implemented. Not sure it will fit well to your requirements, but it's the closest I've ever seen. I was looking for the same thing months ago, and then I discovered the article.
http://www.drdobbs.com/architect/218400678
Maven has a native code plugin. I don't think it'll do everything you want, but it's good at tracking version numbers of dependencies, will build artefacts and it'll work with your VCS.
No idea
cmake/scons: I have used cmake but I don't exactly love it, but I have heard really good things about scons. But scons is python-based, so you need to have python installed on the build/dev machines.
I use Hudson, which has a plugin to fetch from svn. It performs intelligently in general, and in particular builds only if some file has changed in an svn update. Hudson is easy to get started with. Hudson is java-based and is pretty popular with the Java community. This means it is quite cross-platform, but you need to have JRE installed on the build machine.
Probably can call some rpm tool within hudson.