Improving IDE support for dynamic languages like Groovy by taking a "Word" like approach?

I love how much more I can do with so little code in Groovy, but from time to time I miss the instant IDE feedback I got with a strongly typed langauge like Java. This argument is often made against Groovy , and the response is always that you should unit test your code anyway. Don't get me wrong, I'm absolutely all in favor of unit testing, but the time it takes from I make a simple spelling mistake until one of mye unit tests catches it annoys me.

Wouldn't it be nice if IDEs could detect really obvious spelling mistakes?

All the dynamic-voodoo-meta-magic going on behind the scenes in languages like Groovy makes it hard to implement IDEs with really good auto completion and error detection, but there are some really obvious errors that I think IDEs should be able to catch just by taking a simple "Word" like approach. I've made a simple mockup using NetBeans to illustrate my point:

Did you mean..?

Say that I've typed 'relatdArticles', it can't be found in any fields, parameters or local declarations, but there is a local variable declaration that's almost identical. It would be so nice if the IDE could give me a little hint that I might have a typo in my code. Perhaps something for Spring STS ?

The cost of testing in Grails

Peter Ledbrook was just appointed "Groovy & Grails evangelist" for VMWare (cool title and a really good choice!). He has written a good blog entry with the already mentioned argument that you should unit test your code no matter what language you're using, and that in doing so you'll catch most of the bugs caused by spelling mistakes.

His arguments are absolutely valid, but with Grails the cost of just running a single unit test is quite high. Just bringing up the first unit test takes somewhere between 12 and 15 seconds on my 2.5GHz quad core machine! To be absolutely clear, I don't want to get out of writing unit tests, but I want as early error detection as possible!

What do you think?

I really don't know anything about programming of IDEs, but this feels a little like a "low hanging fruit" to me.

User comments

Gravatar

noah - 23. Apr 2010 15:59

Eclipse and IntelliJ do this. They underline anything that can't be statically resolved.

Gravatar

David Mitchell - 23. Apr 2010 17:29

Take a look at Smalltalk IDEs. Dynamic and have proposed corrections on saving a method save since the 1980s. Cincom Smalltalk probably has the best intellisense, but the open-source Pharo would have free code and ideas from which to steal. Certainly harder to do than statically typed languages, but there is a lot you can do.

Gravatar

Olivier Gourment - 24. Apr 2010 19:23

IntelliJ checks the spelling, suggesting fixes from an English dictionary. This would solve your problem. Give it a try!

Gravatar

Gormant Hickers - 30. Dec 2011 22:40

For such spelling mistakes it is often a good idea to use static desk checking. This consists of examining the source code shortly after having typed it into your IDE. It works a treat.


Fork me on GitHub