Scala is a general purpose programming language designed to express common programming patterns in a concise, elegant, and type-safe way. It smoothly integrates features of object-oriented and functional languages. It is also fully interoperable with Java.
I've spent some time trying out some of the examples in the Scala tutorials and I like what I see. It's a pure OO language with none of the ugliness we see in Java. It supports the functional style of development. It's statically typed, but supports type inference, so for the obvious cases you don't have to declare variable types.
Why Scala? Well, first, it has a neat Actor library which looks very promising and rather Erlangy (I believe studying and understanding concurrency is important). Second is that it targets the Java JVM, and older versions used to also target the .Net CLR and (so I hear) will do so again in the future. It of course allows interop with existing JVM/CLR libraries. And most importantly, it isn't Erlang.
I'm not saying I have anything against Erlang, but since everyone is going on about Erlang and Yaws and Erlyweb and what have you (interesting discussion here), I'm going to be cussed and pick something else to learn.
Incidentally, the other contender in my 'language to learn this year' contest was Io, which some of my colleagues are already quite fond of (it surfaces on the internal ThoughtWorks developer mailing lists every few months). Io is a pure OO language with Actor based concurrency support, but it uses a prototype-based object model similar to that in Javascript. Understanding one new programming style (using Actors) is going to be hard enough for me with throwing that into the mix.
I'm trying to get beyond the 'Hello World!' stage with Scala by using lift, a fairly young web framework which is supposed to integrate the best features of all the existing frameworks including stuff like support for comet. This is pretty much how I got started with Ruby - I started with Rails and learned Ruby syntax and usage by looking at Rails code. Since this has worked once, I'm hoping it'll work again.
The initial stages of learning a new language always annoy me, when I look at some code and can't understand the syntax (Ruby used to drive up the wall), I don't know where to look for a solution if I have a problem and most importantly, my development environment isn't all figured out. I'm running into some of that already because my initial attempts to compile lift have failed - the Scala compiler ran out of heap space. Nothing to be found online on this. A quick look at the maven build scripts (and I'm not familiar with maven either) reveals the following
<configuration>
<maxmemory>1524m</maxmemory>
</configuration>
1524 MB! Yipe! Not that my laptop can't manage that, but still, 1.5 Gigs? Looks like I'll be spending some time on the lift mailing lists.
Let's see how this works out - I'll post updates whenever something interesting surfaces.
6 comments:
interesting..but i feel on jvm , groovy is pretty cool as its interoperability is seamless on jvm and the syntax is quite neat...
My first consideration was that the language should support concurrent programming using the Actor model. I haven't come across anything like that for Groovy. Is there an Actor library for Groovy?
Then there is the whole argument of just using JRuby instead of messing around with Groovy if that's the kind of syntax your looking for (though Grails is very interesting, I must admit - how are your experiences with it?).
And finally, there is performance.
hey, yep i love groovy and Grails.. i think this is one great thing that could have ever happened on Java Platform.. it was very much required. considering the simplicity , expressive syntax of the dynamically typed language plus java runtime together makes a killer combination.
As far as the Actor library is concerned here it is ->http://www.groovyactors.org/examples/00.html
Well,i have never ever tried to profile the performance.. probably that would be my assignment for this week end, trust me Groovy performance shouldnt be that bad (with ref to your link..)will update to you on that soon..
http://alterlabs.com/general/articles/grails-vs-rails-the-thrilla-in-manilla-a-study-on-grails-productivity/
Just ccheck that..
Scala performance will be about a zillion times better than Groovy.
1. the 1.5G max heap is probably because the developer decided to put a huge number to avoid problems, and forgot (or didn't want to) actually tune it.
2. Performance: yes, right now Groovy is a stinkeroo in that Dept, and it's highly unlikely (because of language design differences) that Groovy will ever manage to come close to Java and Scala performance. Scala's performance is already nearly equal to equivalent native Java code.
3. Concurrency: you can achieve the same thing in Java, and in Groovy as you can in Scala... at a cost. Scala's actor framework and case classes are something that would require a lot of code to reproduce in either Groovy or Java.
4. Lift looks promising, and seems to be nearing 1.0...
Yep, scala is a winner for me!
Post a Comment