views:

89

answers:

4

Hi,

I'm an everyday C#/ASP.NET MVC/Visual Studio user and i've just started a project in JAVA/GRails/Eclipse but i'm finding it quite difficult to use Eclipse's debugging features and find them somewhat limited compared to Visual Studio's. In particular, i'm finding the following rather disappointing but i don't know if they're limitations of Eclipse as a vanilla IDE or the fact that i'm trying to use it for development using Grails.

  1. Seemingly poor equivalent of Visual Studio's "Immediate Window" - In VS i use the Immediate window all the time during debugging and I've found that in eclipse the equivalent is the "Display" View. However, whereas in VS i can type the name of an object (e.g. "?user") and upon hitting enter i'm given all the properties/methods of the object, in eclipse i have to highlight the expression and then explicitly tell it to either Inspect, execute etc. Having done so, it then adds the results of the Inspection to another window forcing me to go between the two.

  2. The Display View seems to be unable to actually evaluate properties or methods. If, for example, i have an instance of a User class and in the Display window i type userInstance.FirstName or call a method such as userInstance.FullName(), i get evaluation failed errors: "The method FullName() is undefined for the type Object". Furthermore, if i add a watch for the instance i can see the properties but again the method is nowhere to be seen. However, the method evaluates fine as an expression within a block of code (proving that it does exist and is recognised)

  3. Also, although various documentations state that it's possible to add a watch by simply highlighting an object, right clicking and adding a Watch this option seems not to be there so i'm having to type the object into the Display view, highlight it and add a watch from the display view context menu.

  4. Evaluating expressions such as User.get(params.id) (again in the Display view) returns errors such as the following:

User.get(params.id)
Evaluation failed. Reason(s): params cannot be resolved

However, it evaluates fine while stepping over the code. Is this due to the dynamic nature of Grails/Groovy?

Code snippets:

User.groovy:

class User {

    String firstName
    String lastName
    String middleName
    private String fullname

    static constraints = {
        firstName(blank:false)
        lastName(blank:false)
        middleName(blank:false)
    }

    public String FullName()
    {
        fullname = firstName + " " + lastName;
    }
}

UserController.groovy:

class UserController {

...

   def show = {
        User userInstance = User.get(params.id)
        userInstance.FullName()
        if (!userInstance) {
            flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'user.label', default: 'User'), params.id])}"
            redirect(action: "list")
        }
        else {
            [userInstance: userInstance]
        }
    }

...

}

Can anyone say whether these are limitations of Eclipse, the Grails Plugins for Eclipse or possibly something else. Whatever the case, they're making development of an MVC web application using JAVA much less appealing that the equivalent ASP.NET MVC that i've used.

Thanks

+1  A: 

First of all SpringSource Tool Suite is much improved when it comes to working with Grails and Groovy. So I suggest you try that. However you will still have the same issues.

For point 1, I too miss the Immediate window.

The Reason why points 2-4 don't work is because of the dynamic nature of Groovy, Eclipse only knows how to work with Plain Java Objects and while they are Java objects Groovy adds to the Objects, such as Dynamic methods which Eclipse has no idea about.

I cannot speak about Netbeans of Idea, but you may want to check them out.

Scott Warren
Hi Scott, thanks for your comments. You have essentially confirmed what i feared was the case.I can understand these limitations for dynamic properties/methods of the object but i can't seem to understand why it's also the case for properties/methods that i've defined in the object. As mentioned in point 2 even for methods that are defined at design type (e.g. the FullName() method) the debugger seems to have no knowledge of them (The method FullName() is undefined)Do you or anyone know why that is so? Is it just because it's a groovy class so eclipse just doesn't understand it at all?
Matthew
+1  A: 

I evaluated all 3 major Java IDEs for Groovy/Grails development about 6 months ago and IntelliJ IDEA was far ahead of the other two. I don't know if they've improved since, but I'm still using IntelliJ today and am very happy with it. It's support for debugging Groovy is excellent and allows you to do all the things you've described above. I know it's not free, but in my opinion, it's worth every cent.

Don
A: 

I am in the same boat, evaluating Grails for a project and I've tried all of the IDEs previously mentioned. I don't like any of them. They feel remarkably slow compared to XCode or Visual Studio for example, probably because all/most Java IDEs are written in Java.

That being said, I am strongly considering using SpringSource Tool Suite because at least it supports the vi keybinding plugin and it's free.

Cliff
A: 

Once you have gained some experience in using the platform getting used to any non-IDE editor (I like the one that comes with Far Manager) is a piece of cake.

Personally I've not used neither of those IDEs to create the latest project and it went a lot faster than any other project I've worked on.

Funny thing is that because I don't have an IDE to tell me I'm misspelling something I created lots of unit tests (which you should be doing anyways) and I'm using auto-test plugin for doing the testing. It's tons of fun like that and I have nothing to hold me down when I type - just pure creation :)

Matthias Hryniszak