Scala is Groovy

Groovy’s creator endorses Scala. Scala is very promising. When I first read Odersky’s academic paper several years ago, I was put off by the complexity of the type system. But it becomes more attractive when you look at the everyday programming aspects of the language. It does a very nice job of synthesizing functional and OO programming, and eliminating a lot of the boilerplate in Java. I would consider Scala for my own work, except that it depends on Java for UI, which is an epic failure. But for server-side programming Scala is a promising alternative to Java.

9 Replies to “Scala is Groovy”

  1. Scala is a great language, and there are many constructs that I miss (case classes, extensible pattern matching, traits, flexible implicit conversions, type members…). However, I’ve become content with C#, which has its own benefits (a general step up from Java, non-erased generics are how generics should have been done in the first place, DLR allows for convenient dynamic code generation). Still, I’m way more productive in Scala than C#…

    The big issue for me as you is UI platform: what APIs are there for you to play with? The JVM has been stagnant for awhile with a focus on web/servers and a large neglect for next generation UI. .NET has WinForms (last gen UI), WPF (current gen UI), Silverlight (stripped-down WPF for web), XNA (games), and now even DirectX 9/10/11 (via the Windows Code API Pack). Java has…Swing (last gen UI), JOGL (comparable to DirectX but not evolving), SWT (faster last gen UI but with a crappier interface than Swing), GWT (limited web UIs), and JavaFX. JavaFX is comparable to WPF and/or Silverlight, but hasn’t lived up to this potential. I’m having a blast doing UI on .NET, there is so much UI stuff to play with (i.e., pixel shaders!). On the other hand, none of this runs under OS X, which is sad because I own three Macs and no PCs.

    At any rate, Swing is dead for modern UIs, and I see the JVM platform dying as a platform for modern and experimental UI. I would love to see Scala on .NET but I’ve been waiting a long time without seeing any kind of progress, so I’ve basically given up hope. Also, the type erased nature of Scala means that creating an C#-interoperable version of Scala on .NET would be very difficult (perhaps the DLR would help, who knows). So my love affair with Scala has basically ended up in heartbreak, although I gained so much from my experience from working with the language and its creators.

    1. I am totally with you, Sean. It strikes me that you are uniquely qualified to fix this problem. You are an expert in both Scala and next-gen UI. Why don’t you bridge Scala and JavaFX? And throw in some Superglue/Bling magic for good measure.

      JFX is still immature, but it has the basics, and Sun is investing in it. Unfortunately Sun is not providing a Java API into JFX. What were they thinking? But it should be possible to reverse engineer. Andres Almiray has started a bridge from Groovy: FxBuilder. Some sort of collab might be possible. What do you think?

      1. Bling essentially turns WPF into something like JavaFX by providing high-level language abstractions for databinding and animation (hacked into C# using properties and operator overloading). I suspect JavaFX in Java would look a lot like conventional WPF in C# without XAML, which would probably be pretty ugly. I see why Sun would be hesitant to enable access of the JavaFX library from within Java, but they could mitigate that by providing in language abstractions for databinding and animation (i.e., evolve Java!). Scala has no such limitation, and I believe ScalaFX (an ongoing project at the EPFL that I’m not involved in) will provide what you want eventually.

        However, even with something like ScalaFX, you are still limited to the Java environment though…one of the best things I like about .NET is that I can play around directly with programmable GPUs: I can dynamically generate and load vertex and pixel shaders…which form their own powerful computational model (Bling provides support for WPF pixel shaders, will eventually support DirectX 10 vertex,pixel shaders). I think harnessing the power of programmable GPUs in a high-level way is the key to next generation UIs.

  2. This has nothing to do with your post, but is relevant to recent discussion on your blog. The following article by Meyer pretty much reflects how I feel:

    I don’t at all think academia suffers from being too conservative: on the contrary, I think too much research suffers from being (marketed as) too revolutionary. ( Not intended as criticism, just as follow-up on earlier conversation.)

  3. You don’t need to depend on using Java for the UI.

    For example, I do Scala on the server side as part of JBoss SEAM Framework and my client side is Adobe FLEX, they are joined together with GraniteDS. In this way, I can run Scala code, its run on the server and all UI is on the client in FLEX.

  4. “I would consider Scala for my own work, except that it depends on Java for UI, which is an epic failure.”

    Hilarious. I laughed so hard at that. The pathetic UI-ability of Java is what made me fall out of love with it when I first got into programming. So embarrassingly ugly and limity. But I love Java as a server. And when I say Java, of course I really mean Adobe ColdFusion. Java’s Michael Jordan of a baby.

Comments are closed.