Agile Zone is brought to you in partnership with:

I am a software engineer at Google on the Android project and the creator of the Java testing framework TestNG. When I'm not updating this weblog with various software-related posts or speaking at conferences, I am busy snowboarding, playing squash, tennis, golf or volleyball or scuba diving. Cedric is a DZone MVB and is not an employee of DZone and has posted 90 posts at DZone. You can read more from them at their website. View Full User Profile

From Scala back to Java

02.24.2011
| 13604 views |
  • submit to reddit

Here is a very interesting story of someone who started using Scala and then decided to come back to Java:

My experiment with Scala is not working out. It’s just not ready for prime time, and is overkill for my needs. Reluctantly, I am falling back to Java.

Here are some of the reasons why this blog post stands out for me:

  • The author didn’t simply look at Scala and shy away from it, he actually started his project but he got bogged down by various obstacles and he decided that he wasn’t going to get a return on his investment (“I wish Scala the best, but I have work to do”).

  • He also still gives plenty of credit to Scala, and while he hasn’t been completely turned off from it, the combination of subpar tooling, language complexity and compiler quirks led to him abandoning Scala for his project.

  • The comments are all extremely interesting, make sure you read them all. No flame wars, no fanboyism, just educated answers from professionals. And Martin stepped in as well.

Here are a few notable quotes from this post along with my thoughts.

Martin Odersky:

It’s true that functional programming folks are increasingly picking [Scala] up. This is a good thing, IMO, because it pushes the envelope of what you can do with the language

This statement concerns me. First, I’m not sure that the envelope needs to be pushed any further in Scala. A lot of potential users are routinely turned off by its excessive functional and academic aspects and its complex type system. The interaction between functional and object oriented features already feels pretty complex to handle, so I certainly don’t want the language to evolve any further. I hope that future efforts will be oriented more toward the libraries and the tools than the language

I think Scala has pushed the functional envelope already a bit too far for comfort.

A commenter named Nat said:

The powerful, convenient type checking is made redundant by the powerful, convenient implicits

I think this is a good way to capture the observation I made above about how the interaction of complex features leads to even more complex behaviors.

Martin Odersky:

I have now switched for all of my development work to our as yet unreleased version of the Scala plugin for Eclipse. That’s after 20 years of emacs. And I am not looking back.

Now I found this quote quite perplexing. The good news is that with Martin’s team taking over the Scala Eclipse plug-in, I am hopeful that we will finally get some significant progress in that area.

However, I am disappointed to learn that until recently, Martin was still using Emacs to write Scala (and I’m guessing, Java before he switched). For those of you who are not familiar with my opinion on the subject, I’ll summarize it thusly: if you are currently using a text editor to write Java/Scala code, you will be even more productive if you switch to Eclipse or IDEA.

The fact that Martin was still using Emacs to write code until recently probably explains why progress on the Scala IDE front has been so glacially slow. And this is tragic because I’m sure that a lot of developers have been turned off from Scala because of the lack of a good IDE plug-in. I’m hoping that with this new direction, Martin will mandate everyone on the core team to force themselves to use Eclipse in order to dogfood and improve the plug-in. It’s the only way we’ll see any progress.

This situation is pretty shameful, to be honest. Scala is about seven years old and the absence of decent IDE support after such a period of time is absolutely unforgiveable, especially given the ambitions of the Scala team.

Jonathan Edwards, the author of the blog post, is going even further:

Design the IDE first, then build a language that does what it needs.

This sounds a bit extreme to me, but I absolutely believe that in order for a language to become successful, both the languages and the productivity tools that surround it (IDE, debugger, etc…) need to be built in lockstep. Granted, this might slow down the development of the language itself, but I see this as a good thing: bringing up the entire stack at the same time is a great way to make sure that the language remains manageable. If your language has become too complex for IDE’s to handle, how do you think users will feel about it?

And this brings us to another weakness of Scala, which Martin himself touches on in another comment:

But what’s absolutely necessary is that the people who work on the IDE have an intimate knowledge of the compiler internals.

This sentence is probably the main reason why IDE support has been so slow. There are obviously very few people who are familiar with the Scala compiler internals (and I remember hearing somebody say that there are probably areas of the compiler that nobody understands any more, I wonder if it wasn’t Martin himself), so the bar is impossibly high for a Scala plug-in to happen.

Sadly, cooperation from the Scala compiler seems completely unavoidable if you want to deliver a decent plug-in, if only because the IDE will need help resolving inferred types and probably other potentially complex constructs such as implicits. I hear Martin’s team is working hard on the compiler so that it will expose a clean API that tools can work with. Let’s hope this work will come to fruition sooner than later.

One last thing: Fantom receives a well deserved mention in this thread. If you still haven’t looked into Fantom and if you are looking for Java’s successor, I strongly encourage you to go take a look at it now.

References
Published at DZone with permission of Cedric Beust, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Mats Henricson replied on Thu, 2011/02/24 - 10:27am

Oh great, Cederic, pimping that story even further!

Mark Haniford replied on Thu, 2011/02/24 - 11:49am

I've been on the Scala IDE mailing list for a long time and it's just bug after bug after bug.  And as stated, it's amazing that Martin only recently switched from Emacs.

There's still a prevailing attitude among many of "Language X is so powerful that all you need is an Emacs plugin".  I guess some people will never get it.

 It's really time for someone with deep pockets to invest in Groovy++.  Scala had its chance.  There's this thing called time to market, and Scala missed it.

Jacek Furmankiewicz replied on Thu, 2011/02/24 - 1:43pm

Here's my simple prediction: by the time java 8 rolls around next year with some of the basic features that people have been screaming for (lambdas, map literals, etc.) the value added of the JVM languages will continue to diminish.
So if Groovy and Scala can't make a serious dent at a time where they have a clear advantage (feature wise) over Java, then I think the chance of them making it once Java gets many of those features will be next to nill.

Mike P(Okidoky) replied on Thu, 2011/02/24 - 4:22pm

"if you are currently using a text editor to write Java/Scala code, you will be even more productive if you switch to Eclipse or IDEA."

Calling emacs a "text editor" as if it's just a notepad or something, is an insult. I code in Vim, and built a debugger that lets me interface with it. I have numerous of scripts and custom keys. I can run up and down source files, find stuff, and manipulate code quicker than I have ever seen anyone try in Eclipse. I find editing and navigating in an IDE painful, clumsy. I equate these "editors" much close to a notepad than Emacs or Vim. I bet Martin fully agrees with me on this. I wouldn't be surprised if he still uses Emacs, and perhaps found a way to use them together. I've tried the Vim plugins for Eclipse, doesn't work.

Mario Fusco replied on Thu, 2011/02/24 - 5:23pm

I agree about the IDE issue but I suppose it's just a matter of time. For all the rest, well ... just show me a single case were Scala is more complex or less workable than Java. Since you're mentioning Martin's quotes maybe it also worth metion his post about Scala complexity.

Endre Varga replied on Fri, 2011/02/25 - 9:22am

Dunno, I was shying away from Scala at the beginning, but nowadays I completely switched from Java to Scala. I use IDEA's Scala plugin, and it is fine for me. It's true, however, that IDE tooling is seriously lacking in functionality. At the end however the benefits of the language outweighed the problems I had with tooling.

Jason Cone replied on Fri, 2011/02/25 - 12:35pm

I recently started checking out Scala, and I like it so far. The learning curve (and shift in thinking that surrounds the imperative vs. functional approaches) is a little daunting, but you can take it as gradually as you need to. While Java remains my go-to language, I've managed to use Scala for "real work" in a few cases: the way you can integrate with existing Java code helps quite a bit. On the tooling, I've only tried Netbeans and Emacs + Ensime. When I looked at the Eclipse plugin, it didn't support Helios (and I usually find Eclipse to feel sluggish, anyway), so I didn't bother. For now, I'm using emacs+ensime, but an IDE that supports Scala with sbt (instead of ant or maven) and git would probably win me over.

Bernhard Messerer replied on Wed, 2011/03/09 - 5:12am in response to: Jason Cone

I'm using IDEA+IDEA Scala plugin and this is great - it supports sbt, git and most of the language itself - you may try it, AFAIK the Scala plugin works with IDEA community edition.

Shumona Kapil replied on Sun, 2012/02/19 - 10:00am

I’m a Scala fanboy, but would I go writing blog posts about how Ruby or Groovy or whatever other language have drawbacks or failures? No, why would I? These languages just aren’t interesting to me, so why bother?

And, your conclusions in your blog are just over the top. When Martin tells us he just switched from Emacs to Eclipse+Scala plugin, then you stab this good news in the back by claiming this is evidence Eclipse+plugin just was too bad quality. There just is no way for Martin + Scala to win in your eyes.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.