domenica 27 maggio 2012

OO-GC Language for standalone executables

Recently I have looked toward an object oriented-garbage collected programming language, able to build a standalone executable. The reason is simple, I'm in need to deploy applications on Linux servers by minimizing installation requirements.
Performance and portability are highly appreciated features

JAVA

Great language, high performance, big user base and lot of resources but there is no way to bundle a minimal VM and dependencies in a single executable, so ,you are in need to move the full framework around with your tiny console application.
There is also the GCJ which provides a java compiler but it looks unmaintained and there are no updates since 2009. Using GCJ looks more like an hack to me but further inspection is needed.
UPDATE: This project, Avian is a "lightweight Java VM and class library designed to provide a useful subset of Java's features, suitable for building self-contained applications"[Wikipedia]. This looks like the way to build a standalone executable from current Java code. Java + Avian looks like a second (au pair) winner.
I hope to try out this soon.


OCAML (Objective CAML)

It looks promising.
Tricky language which merges functional and imperative paradigms and has the garbage collection; Ocaml builds native binaries or creates an executable which bundles together a minimal Ocaml's VM and application bytecode; Ocaml single thread performance is quite good both with native and bytecode applications.
Base Ocaml and 3th-party developers provides a fair amount of libraries.
The Ocaml cons are that it doesn't support real multithreading (you have to use 3-party libraries, but it looks just an hack).
Another issue is about being a bit unusual (functional style programming is not the first choice) language with a little user base.

C# (MONO)

It looks more promising.
Mono works with well-known OO languages (I like C#), large user base, garbage collector, very large standard library and lots of 3th-party libraries and there are lot of resources around.
Good single thread performance as well as support for real multithreading.
About having a standalone executable, you can make it by using mkbundle.(I have to check it out)
It looks like the winner. updated in Part2

GO

Last but not least, this language is an interesting new entry and the reason behind this post; One year ago I have thought about this new language being useless, I was wrong.
At the moment I think I have understood two reasons behind the Google Go project:
  • provide an (about) OO, garbage collected, language which compiles to a native executable
  • provide a new approach to OO programming, Go doesn't provide inheritance or method overloading  but enforces interfaces as unique alternative.

Go developers state that inheritance is a dangerous feature; you know, inheritance is not about code reuse but is about abstraction, about sharing functionalities between conceptually similar objects and about taking advantage of polymorphism but inheritance is sometimes... misused.
Code reuse is still important and it is possible with Go by using composition and interfaces  (instead of inheritance). This is intriguing.
I think that the GO language deserves further inspection.

There are also big cons, it is a young language with a little library base and very tiny user base. But I have added "Go" as one of my Schemer Tasks for a Brighter Future!

It doesn't fit with the topic but I also suggest my readers to have a look at this interesting article programming language trends.
This post is a start point, I think I'll go deeper into Mono,GO and have a look at gcj but at the moment I'm highly oriented toward Mono. 
I'll let you updated on the topic.

Further details in Part 2