Scripting of Java applications

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 http://wiki.apache.org/apachecon/BirdsOfaFeatherEu09

Advertisements

Tags: ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: