Another Java vs. Scala perspective - is this typical? - eclipse

I have been reading about Scala for a while and even wrote some small programs to better understand some of the more exoteric features.
Today I decided to do my first "real project", translating some 60 lines of ugly Java code to Scala to rewrite it using the better pattern-matching features (why? because the Java version was becoming hard to maintain due to excessive combination of regex and conditionals).
About halfway through the editing process, Eclipse thew up this error:
alt text http://img269.imageshack.us/img269/1243/errorms.jpg
I get the general impression that the Scala IDE in Eclipse is a lot buggier and less complete than its Java equivalent. Is this correct or do I just have a bad installation? Is there a better IDE for Scala?

I really like IntelliJ Idea Community Edition's Scala support. I've been using it from it's early days. I've also tested Netbeans and Eclipse plugins but I really don't like them that much. Especially all Eclipse Scala plugins are crap. I also tested Textmate Scala bundle, which is very nice but doesn't offer auto completion.
Here is my Scala Ide top list:
IntelliJ Idea Community Edition
Netbeans
Textmate (This is here, since I really like Textmate for writing Rails applications)
Eclipse
When you learn IntelliJ Idea keyboard shortcuts and add some live templates you can be very productive programmer. Furthermore, if you buy the Intellij Idea Ultimate Edition you can even share the settings with multiple computers or with your team.
What I suggest:
Download IntelliJ Idea Community Edition
Install the Scala plugin
Learn the keyboard shortcuts: Windows and Linux, Mac
Configure Live Templates when you get more familiar with the ide

The Eclipse IDE Scala support has not been great for some time, but is now receiving additional development effort alongside the introduction of Scala 2.8, and appears to be improving. For Scala 2.7 I have found the Intellij plugin to be in a better state.
One problem that both of these plugins have is that Scala itself is a moving target - Scala 2.8 has introduced additional syntax and structures to Scala 2.7.

From my own experience with Eclipse, using it for languages other than Java is never quite as good.
You might find this post of interest.

I get the general impression an IDE for a new, young, niche language is a lot buggier and less complete than a widespread, supported, mature language
Try Netbeans. Its plugins are generally of a simpler construction anyway, so should have less 'gotchas'

One point to make is that it is possible that people are still put off IntelliJ because they assume that the licence is expensive, especially if they are happy with Eclipse and are unaware of the Community Edition which is free and open source.
I cannot give any comparison with the other IDEs as I have always used IntelliJ, however the Scala support is certainly good, all things considered, and getting better.

We are using Eclipse Scala plugin at work and working with it is quite terrible. One cannot really trust reported errors inside IDE, runtime exceptions are the order of the day. Our best experience is with build from 25-11-2009.
At home I play with IntelliJ 9 and its Scala plugin and I find it much much better. I am newbie to IntelliJ but I am very impressed with all those little details which (once you get used to them) increase your productivity... a lot.
The drawback is in IntelliJ there is no compile-error reporting on the fly (at the time you're writing code) yet implemented and only Scala up to 2.7 is supported (2.8 by nightly builds only), but there are NO runtime exceptions while working with the IDE. I would recommend you to try IntelliJ, community edition at least.

I never really get on with IDEs at the best of times because they are usually pretty awful at actual text editing, but Eclipse's Scala plugin is particularly brittle to the point that projects "forget" that they are Scala after a while. Battling Eclipse seems to consume more effort than it saves. I just went back to my Emacs and sbt REPL in a terminal.
A light play with IntelliJ confirmed that it does at least do the job as a Scala IDE, but again I didn't care for its editor. It's also commercial software. However, if you are seeking a robust Scala IDE, this is perhaps where you should be looking.
What I have since settled on is perhaps perverse and not for the newcomer, but suits somebody who has definite opinions about their text editor. ENSIME is an editor plugin and server component that adds what you need from a Scala IDE to Emacs. It also claims support for vim, Atom, and Sublime, but I've not tested these. Occasionally it also has a bad day—obscure kinds of macros particularly confuddle it—but it generally does the job.

Related

Using IntelliJ like IntelliJ

I am a backend developer working on a cocktail of JVM based languages(mostly Java). I have been using Eclipse IDE for nearly 4years until a week ago I was mandated to use IntelliJ. I had a look at IntelliJ documentation to figure out the advantages it offers for me over Eclipse,Netbeans,STS etc but it was information overload. Currently I have changed the keymap to Eclipse. I believe IntelliJ has lot more potential which is waiting to be unearthed. What specific advantages does it offer w.r.t exposing/testing REST API, connecting to NoSQL DBs,refactoring code etc over Eclipse.
I won't be able to produce a detailed comparison matrix between IntelliJ and Eclipse but, for me, here are the most common things I miss when using eclipse on the workstation of some colleagues:
code navigation only with the keyboard
refactorings and their associated shortcuts (unlike Alt+Shift+L, Ctrl+Alt+V is actually "smart")
efficient "Find usages" (Ctrl+Alt+F7 or Alt+F7)
While debugging, real code edition with autocompletion (watched, code expressions, code fragments)
The new debugging visualization right in the editor (introduced by IntelliJ 14)
So are only the few things I use when helping colleagues. I'm not even talking about smart autocompletion, property files,
I admit that since I switched over to IntelliJ (~5 years ago) I never dove again into Eclipse. I'm sure they've improved a lot since but, from what I see on a daily basis with some coworkers, I'd rather stop programming than using Eclipse =D
Give it a real and serious try. There is a small time needed to got used to it but once you learn the key mapping and most of its productivity features, I'm almost certain you won't regret it. So far, I know nobody who has.

Is the scala eclipse IDE stable enough?

I use eclipse as my scala IDE. But It seems not so good. I can build my project using maven successfully. But eclipse always warn me there's compilation error. Any has experience of scala eclipse plugin ? Thanks BTW I use scala IDE for 2.8.1
There is a new Eclipse plug-in which is in the final stages of release, currently in beta 4 which offers numerous improvements including stability. It runs with Scala 2.9.
You can download and try it for yourself. More information and download available here:
http://www.scala-ide.org/
Also, be sure to read on improving Eclipse performance, I find a few of these tweaks makes a big difference. Here are some answers on Stackoverflow regarding that:
How can you speed up Eclipse?
What are the best JVM settings for Eclipse?
I've been using all three major IDEs over the last few days for Scala.
Eclipse is pretty good and perfectly useable although you will encounter a few bugs - silly things like you can't load compiler plugins if you have a space in your plugin folder pathname. It also behaved pretty badly a few times and wouldn't run anything until I restarted Eclipse, but this might be partly because I'm new to it and maybe have been doing something wrong. One thing that is good about Eclipse is that the build time is a lot quicker than for the other two - I think this is because it does and "incremental build". Or maybe it's just more optimized, but it's noticeable.
I would recommend trying the latest version of IntelliJ (10.5). It seems to be the best at the moment with the fewest rough edges, and the only one to have Scaladoc support integrated. I haven't used it much but first impressions are good.
The NetBeans plugin seems to be getting left behind a bit (there's only one guy working on it), which is a shame because it has IMO easily the best code editor for Java, with excellent predictive capabilities which you don't get for Scala at the moment. I'll continue to use it for Java, but the Scala plugin development is a bit sparse. (Although it might be because I'm using a beta version, because that's all that's available right now for Scala 2.9.)

Is it a good idea to develop an IDE for scala?

I have to choose a sizable (but not too sizable!) project for my next & last term in university. I thought maybe a nice IDE for scala is what the world might need right now :).
Would you like to see an IDE specifically made for scala? Or are you more comfortable using (the already available) plugins for popular (mainly java) IDEs & editors?
What do you think about the whole idea?
P.s. I'd make it open source & would add features one by one, so if it doesn't end in one semester, it won't be a problem from the university perspective.
Actually, not anymore. IntelliJ, Netbeans and Eclipse all have Scala-specific efforts that have more man-hours in it than you could possible start to begin putting in at a last term. And there's two very interesting efforts that were results of projects like that, both of which were made to contribute to any IDE effort: ENSIME and Scala Refactoring.
And, beyond these efforts, most programming editors, such as jEdit or TextMate, also have some Scala support to one degree or another.
So, really, contributing to one of these projects might be a good idea, but making a Scala IDE is not.
For his Masters thesis, Mirko Stocker contributed the refactoring functionality to the Eclipse Scala plugin, see:
http://misto.ch/scala-refactoring-talk-at-scala-days-2010/
Instead of creating an IDE from scratch, why not contribute a major piece of functionality to the Eclipse plugin, all contributions are welcome. For ideas, see tickets.
Or instead of reinventing the wheel.. you can contribute..
http://wiki.netbeans.org/Scala
But I am not sure if it will be somehow enough for your university work. At the same time, as you see, those plug-ins still require a lot of work.
While writing your own IDE you will just trying to solve problems that were already solved and tested. Besides, even if - what kind of IDE is that, which allows you to do
Scala (even if its great) only. So just for simple xml edit of ant file or whatever you will need another tool.
I think Brian Clapper already summed it up nicely.
I'd suggest something like CheckStyle but for Scala might go down well and be reasonable to tackle as a project.
Not a Scala developer but an Eclipse plug-in would probably be a worthy senior project.
Concur. Operating systems, text editors, and IDEs...does the world really need more of them? No. But everyone wants to write one.
If you want to do something useful, as opposed to simply academic, develop an extension for an existing IDE. Eclipse, NetBeans, Komodo, etc. are all nicely extensible through plugins.

using eclipse for other languages than java?

I came to know that eclipse can be used for other languages as well. But will it give the same comfort level as using java? Is there anybody who has used eclipse for other languages?
I've used Eclipse for both C/C++, Ruby, Erlang, and a few others. None of these are as tightly integrated with Eclipse as Java is, but CDT (C/C++) gives Visual Studio a good run for its money. I usually use Emacs for the other ones.
Yes, you can use Eclipse for many languages other than Java. I personally use Eclipse to code in C++, Perl, PHP, and do JavaScript as well inside of it. While it also supports plugins for connecting and executing queries against databases, I tend to prefer other options there such as Toad or Oracle SQL Developer. There are numerous other plugins to support many other languages that you can find either through the Update Manager or a simple Google search, many of which are excellent.
As a side note, if you're not using Mylyn, you're missing out.
Eclipse is used as a base for other language and tool:
for example As3 with FlashBuilder; PHP, Javascript with Aptana studio, C,Python,... with other plugins, etc...
You can found here for example some plugins for other languages.
I've used it for Javascript (jQuery): compile-time checks are a godsend to the barren lands of javascript.
For Java developement I feel most comfortable using Eclipse.
I tried using Eclipse for coding with Python. There is PyDev, an Eclipse plugin that can be used to work with the Python code in Eclipse. Though PyDev provides features like Code Completion, Syntax highlighting etc, I felt comfortable to use editors like gvim or emacs rather than Eclipse
for working with Python code. YMMV
Yes, Eclipse supports many other languages.
But you knew that already when you saw http://www.eclipse.org/downloads/
So, I guess that you are asking how well it supports them...
It is possible to have Eclipse without Java. Imagine taking that and then adding Java support. Compare that with CDT for C++ and - in my experience - they are pretty much the same.
Yes, Eclipse is slanted at Java, and I doubt that anyone will deny that, but at the same time it tries to be fair and generic and pretty much achieves it. Any few % less other language support doesn't matter when you realize that no other IDE compares.
Bottom line, whatever your language, you will be hard pushed to beat Eclipse.
And that's before I get started on the myriad plugins ...
Not only programming, debugging with Eclipse is sweet. Beside Java, the other languages I mostly work on Eclipse are PHP and Python.
While I was working on the Eclipse Web Tools Platform (WTP) project we often said that the Java Development Tools (JDT) were the model that we referenced for features for Web related languages. I think JDT has set the bar and many other projects that implement language specific tooling try to reach the JDT bar. I don't know that any have or that copying everything about JDT is the point but I do think the Java tools are exemplary development tools.

What's the best Scala build system? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I've seen questions about IDE's here -- Which is the best IDE for Scala development? and What is the current state of tooling for Scala?, but I've had mixed experiences with IDEs. Right now, I'm using the Eclipse IDE with the automatic workspace refresh option, and KDE 4's Kate as my text editor. Here are some of the problems I'd like to solve:
use my own editor IDEs are really geared at everyone using their components. I like Kate better, but the refresh system is very annoying (it doesn't use inotify, rather, maybe a 10s polling interval). The reason I don't use the built-in text editor is because broken auto-complete functionalities cause the IDE to hang for maybe 10s.
rebuild only modified files The Eclipse build system is broken. It doesn't know when to rebuild classes. I find myself almost half of the time going to project->clean. Worse, it seems even after it has finished building my project, a few minutes later it will pop up with some bizarre error (edit - these errors appear to be things that were previously solved with a project > clean, but then come back up...). Finally, setting "Preferences / Continue launch if project contains errors" to "prompt" seems to have no effect for Scala projects (i.e. it always launches even if there are errors).
build customization I can use the "nightly" release, but I'll want to modify and use my own Scala builds, not the compiler that's built into the IDE's plugin. It would also be nice to pass [e.g.] -Xprint:jvm to the compiler (to print out lowered code).
fast compiling Though Eclipse doesn't always build right, it does seem snappy -- even more so than fsc.
I looked at Ant and Maven, though haven't employed either yet (I'll also need to spend time solving #3 and #4). I wanted to see if anyone has other suggestions before I spend time getting a suboptimal build system working. Thanks in advance!
UPDATE - I'm now using Maven, passing a project as a compiler plugin to it. It seems fast enough; I'm not sure what kind of jar caching Maven does. A current repository for Scala 2.8.0 is available [link]. The archetypes are very cool, and cross-platform support seems very good. However, about compile issues, I'm not sure if fsc is actually fixed, or my project is stable enough (e.g. class names aren't changing) -- running it manually doesn't bother me as much. If you'd like to see an example, feel free to browse the pom.xml files I'm using [github].
UPDATE 2 - from benchmarks I've seen, Daniel Spiewak is right that buildr's faster than Maven (and, if one is doing incremental changes, Maven's 10 second latency gets annoying), so if one can craft a compatible build file, then it's probably worth it...
Points 2 and 4 are extremely difficult to manage with the current scalac. The problem is that Scala's compiler is a little dumb about building files. Basically, it will build whatever you feed it, regardless of whether or not that file really needs to be built. Scala 2.8.0 will have some tremendous improvements in this respect, but until then... Eclipse SDT actually has some very elaborate (and very hackish) code for doing change detection and dependency tracking. On the whole, it does a decent job, but as you have seen, there are wrinkles. Eclipse SDT 2.8.0 will rely on the aforementioned improvements to scalac itself.
So, building only modified files is pretty much out of the question. Aside from SDT, the only tool I know of which even tries this is SBT (Simple Build Tool). It uses a compiler plugin to track files as they are compiled and query the dependency graph computed by the compiler itself. In practice, this yields about a 50% improvement over the recompile-the-world approach. Once again, this is a hack to get around deficiencies in pre-2.8.0 scalac.
The good news is that reasonably fast compilation is still achievable even without worrying about change detection. FSC uses the same technology (ooh, that sounded so "Charlie Eppes") that Eclipse SDT uses to implement fast incremental compilation. In short, it's pretty snappy.
Personally, I use Apache Buildr. Its configuration is significantly cleaner than either Maven's or SBT's and its startup time is orders of magnitude less (when running under MRI). It integrates with FSC and attempts to do some basic change detection on its own (fairly primitive). It also has auto-magical support for the major Scala test frameworks (ScalaTest, ScalaCheck and Specs) as well as support for joint compilation with Java sources and IDE meta generation for IntelliJ and Eclipse. Oh, and it supports all of Maven's features (dependency resolution, etc) and then some. I'm even working on an extension which would allow interactive shell support integrated with JavaRebel and supporting several shell providers (Scala, JIRB, Clojure REPL, etc). It's not ready for the SVN yet, but I'll commit once it's ready (possibly in time for 1.3.5).
As you can see, I'm very firmly of the opinion that Buildr is the best Scala build tool out there. Its documentation is a little spotty where Scala is concerned, but that's because everything is so straightforward that it's hard to document without feeling verbose. You can always check out one of my GitHub repositories for examples. Good luck!
Have you looked at Intellij IDEA and its Scala integration ? Intellij has a loyal (fanatical?) following amongst Java developers, so you may find this is appropriate for your needs.
Am also quite frustrated with the scala plugin on Eclipse and I can add a few more problems to the list:
auto-complete only works some of the time
the debugger doesn't work properly (especially when trying to debug scala xml)
the debugger forgets breakpoints
'go to definition' doesn't work more often than not.
I'm glad to hear that Buildr sounds like a better alternative (on the build front anyhow), I'll give that a try - thanks!
If you use Emacs, I think Ensime is a pretty good IDE. I think at the time writing, Ensime is the only IDE that will give you fast and accurate autocompletion on both Scala and Java objects, including implicit conversions.
There's code browsing support using Speedbar, code templates using the excellent Yasnippet, and code completion menu using Autocomplete. These are all very modern, actively maintained Emacs packages. There's also out of the box incremental building support for Maven and SBT.
There's a lot more in there such as interactive debugging, refactoring, and the Scala interpreter in an inferior process. All the things you want in a modern IDE for Scala is already there in Ensime. Highly recommended for Emacsens.
For the reasons of completeness, I have to say that there is also Pants -- the build tool that in use in Twitter (one of the early scala adopters)
The main difference it that it is intended not only for scala (and written in python, by the way) and is modeled after google build system.
It's not so bloated as sbt, so for the freshmans it's much simplier, but I've never heard about Pants usage outside of twitter and foursquare.
If you scared of SBT, maybe another no-so-popular build tool, ABT, could be an alternative for you?
I went down the same road, and here is where I am at:
- After some initial investigation, I dropped Kate. I love to use it for most things, but when it came to things like defining tab completions, I found it sorely lacking. I would recommend that you look into gedit instead, which is much more robust for Scala development
- With gedit as my editor, I use SBT and have found it to be a great build tool. I can put it into a 'test' mode where when any code changes it recompiles the relevant files and runs my test suite. This has been an extremely effective way to work.
I have not taken a look at Buildr yet. I would like to say that I will, but honestly with SBT at my disposal I don't really have a compelling need to look at another build tool.
If you want to use Eclipse, but build the project using sbt, and still be able to debug, take a look at this post here:
zikaprog.wordpress.com/2010/04/19/scala-eclipse-sbt-and-debugging/
It also can be applied to builders other than sbt.
The latest version of the Maven Scala plugin supports Zinc/Nailgun for faster start times and faster incremental builds. See Zinc and Incremental Compilation.