Archive for the ‘ASF’ Category

Scripting of Java applications

March 26, 2009

Seeting in Zurich room at Apache I can hear various discussions on scripting languages used in Java landscape.

People are sharing their experiences on integration with Java code, performance and general support for one or another scripting languages.

What strikes me personally is why people need scripting language and not just another language? What makes scripting languages attractive or what makes the feeling they are attractive?

It’s just a quick post written during listening to Justin’s talk Putting it all together so I won’t give you a detailed analysis. Just a few points that come to mind instantly:

  • don’t have to deal with types (most if not all scripting languages are untyped or weakly typed)
  • concise syntax
  • syntax sugar for many tiresome code patterns (e.g. closures and function literals instead of anonymous classes and similar heavy solutions)
  • some functional elements (like in Javascript or Ruby where you can pass functions around)

My thought is: what if there is a language which feels like a scripting language but it’s not? Huh???

What I have in mind is Scala. Let’s address points outlined above:

  • Scala is strongly typed language but at the same time it has type inference which removes the need of almost all type declarations in your code. One interesting thing is that even if you don’t write type declarations everywhere types are used in much more powerful way in Scala than they are in Java.
  • Scala is less concise than Perl for example but much more concise than Java and let’s you to express clever solutions to problems in a concise way.
  • Moreover, Scala let’s you to define your own syntax sugar or DSL to make code more readable and less tiresome to write. So you can have as much sugar as you like
  • Scala is a functional language (actually a fusion of OOP and FP) so it has anything you find in scripting languages and even more.

What it’s worth mentioning is that with Scala you get even more than with most of scripting languages namely: perfect interoperability with existing Java code and safe code thanks to strongly typed language.

If there is anyone interested about discussing Scala there is a BoF session this evening. Check details at