Code Completion by IDEs - How Complete ?

Hi

Continuing from "Moving to 3rd Rail"

After being educated on the virtues of NBRubyIde, I was motivated to
actually checked out code completion of the much maligned free Aptana
radrails. This is the result

1. Type validates+ctrl-space
1.1 NBRubyIDE
Result :
validates_presence_of *attr_names

1.2 Aptana RadRails
Result :
validates_presence_of(attributes, :message => "message")

1.3 3rdRail
Result : My test license has expired

Cody, pse fill up the blank :slight_smile:

So guys, which IDE does better code completion ?

Hi Huw

I wish I could test out your statement on code accuracy but
unfortunately, I don't use VS :slight_smile:

Why don't you post what RIS will output when one types

validates+ctrl+space ?

Hi Cody

Great ! I am looking forward to your post :slight_smile:

Hi Huw

The context is that if one selects validates_presence_of , what does
RIS output ?

Hi Huw

It would appear that all 3 IDEs displays a box for one to select the
validation method of choice.
However, it looks as if the resultant source codes are pasted
differently !

For example,

1) using nbRubyIde, once selected, this will appear in your source
codes

   validates_presence_of *attr_names

2) using Aptana RadRails , the following is pasted

   validates_presence_of(attributes, :message => "message")

Can you see the difference ?

What I am interested to know is the resultant code that will be pasted
automatically by RIS :slight_smile:

Hi Joe

Hi Joe

Asking the same question, what does 3rdrail insert when
validates_presence_of is selected ?

Hi Joe

Nope, I was referring to the field test copy and not the trial copy.

Just to be clear: NetBeans also uses type inference for completion
options such that in many cases it gives accurate results. The
validates-example listed earlier on this thread is one such example
where it knows exactly what the inherited and mixed in methods are in
the current context, and can complete accurately.

However, it -also- relies on heuristics in cases where it's not sure,
such as a call to a method whose return type is unknown. I looked at
the video you linked to and the narrator states that 3rdRail relies
type inference and "Rails Conventions" - which sounds like heuristics
to me. And in a dynamic language like Ruby I don't think there's any
way to NOT use heuristics if you want to offer reasonable completion -
with methods and classes being modified dynamically computing the
correct set of methods etc. requires solving the Halting Problem.

Anyway, NetBeans doesn't do parameter completion right yet; I had
started that work but disabled it until I could finish it as I got
distracted with other tasks. This discussion has inspired me to go and
look at that code again :slight_smile:

-- Tor

Hi Tor

Anyway, NetBeans doesn't do parameter completion right yet; I had
started that work but disabled it until I could finish it as I got
distracted with other tasks. This discussion has inspired me to go and
look at that code again :slight_smile:

cch: I started this discussion :slight_smile:

It is great to know that you are so responsive.

For the time being, it looks as if RadRails have the best code
completion (for novices and newbies anyway)

BTW, I have been trying nbRubyIDE(standalone) on and off and one
concern of mine is starting speed and indexing of project.
I have perhaps 10 projects (each with perhaps 50 controllers or more)
in the nRubyIDE. It does take quite a bit of time to start up.
Is there anything that I can do on my end.

From Tor

Just to be clear: NetBeans also uses type inference for completion
options such that in many cases it gives accurate results. The
validates-example listed earlier on this thread is one such example
where it knows exactly what the inherited and mixed in methods are in
the current context, and can complete accurately.

Hi Tor,

Thanks for the clarification, I have to admit my knowledge of the
inner workings of NB is second hand.

Joe

Hi Joe

Since there was no answer forthcoming from you as to what was inserted
on code completing validate, I decided to download the Trial.

Just wasted 1 hour to download the Trial just to get this message
3rd Rail Trial License , O (days) left on trail

What is this ? Wasn't 3rdRail just launched on 17th Sept ???

CCH wrote:

Hi Joe

Since there was no answer forthcoming from you as to what was inserted
on code completing validate, I decided to download the Trial.

Just wasted 1 hour to download the Trial just to get this message
3rd Rail Trial License , O (days) left on trail

What is this ? Wasn't 3rdRail just launched on 17th Sept ???

Do you need to activate the trial on CodeGear's website?

Hi Anthony

Thanx !

Hi

The result is out for code completion of a simple typing of
  validates+ctrl_space

1.1 NBRubyIDE
Result :
validates_presence_of *attr_names

1.2 Aptana RadRails
Result :
validates_presence_of(attributes, :message => "message")

1.3 Ruby in Steel
Result :
validates_presence_of

1.4 3rdRail
Result :
validates_presence_of

CONCLUSION :
So seemingly, Aptana RadRails has the most useful code completion for
this simple test.

To be fair, I have seen a Video cast of Shelby of CodeGear showing
impressive code completion on a migration file.
In addition, Tor of netbeans had already promised to look into
improving the completion code for my random example.

CCH, on the download page it has instructions for requesting a key,
you do need to register it.

CONCLUSION :
So seemingly, Aptana RadRails has the most useful code completion for
this simple test.

To be fair, I have seen a Video cast of Shelby of CodeGear showing
impressive code completion on a migration file.
In addition, Tor of netbeans had already promised to look into
improving the completion code for my random example.

CCH,

Like I've said, code completion is much more complex than this, you
can't select one scenario to judge all IDEs. Each has it's strengths
and weaknesses. I can pick out an example that makes NetBeans look
great or one that makes 3rdRail The Ruler.

This is why I haven't been pasting specific examples here. No one
wants this to become a relegious war, arguing one discrete example
against the other.

Two things that would be more productive IMO:

1. If you find shortcomings in a tool report them to the folks that
make the tool so they can make it better.

2. If you really want to compare code completion, put together a
comprehensive matrix of places where completion should exist (types of
files, types of code fragments, different kind of syntax errors the
completion should recover from) and what choices should be provided
and do a complete comparison. This would show intersections for
different situations (methods defined on a parent class, methods
defined in the current class, dynamic methods provided by the
framework, dynamic methods provided by user code, for a simple
example) and what would be provided there (paramater arity, paramater
types, locally-defined paramater choices, paramater choices that are
made available by the framework, method calls that return the type
represented by the paramater...etc)

Then users can look at this and decide which tool best meets their
needs.

Just my two cents.

Hi Joe /Huw

Of course, both of you are right.

What I was trying to point out was that sweeping statements made by
overzealous fans/developers etc of IDEs can easily be debunked !
IMHO, one should by all means trumpet the great features (eg, Project
Commander in 3rd Rail) but not at the expense of condemning another
with four-letter words.

I believe, I have already made my point :slight_smile:

The bottom line is that there must be healthy competition and IDE
developers who do not wish to accept constructive criticism and
improve will simply perish...

TQ

Hi Cody

CCH,

What O/S are you running? On Windows XP, the following happens (I just
tested this):

cchL Windows XP Pro, SP2

validates_presence_of <ctrl-spacebar>
... :description
... :email
... :*other_attributes*
... find_all_by_description(description, *options) - ::User
... find_all_by_email(description, *options) - ::User
... find_all_by_*other_attr*(description, *options) - ::User

cch: When I type validates+ctrl+spacebar in 3rdRail
a dropdown list is shown and when I select validates_presence_of ,
validates_presence_of is inserted

Radrails inserts

validates_presence_of(attributes, :message => "message")

which is clearly more appropriate :slight_smile:

Hi Code

Aptana Radrails have similar functionality, check it out..

Hi Chris