Jump to content

midnite

Recommended Posts

First of all, i am particularly focusing on the cross-reference across files feature.

 

What is it? Simply say, it is like writing Java in Eclipse or Netbeans:

  • When we "dot" a class, a pull down list of member variables show up.
  • When we "ctrl + click" on a usage (of a variable, of a class, of a method, etc), it jumps to the definition of it.

I particularly see this feature very helpful, especially when our project goes huge. If we don't need the benefits from this feature, why not use the free and quick editor - Notepad++ ?

 

Many PHP dev tools are equipped with the reference feature. But not many of them can do it across different files. (means in case the definition occurs in a different file of usage.)

 

While I was finding such a (free) IDE which can do this, I heard people keep saying the Eclipse PDT cannot reference across files. Until today, I give it a try. And surprisingly, Eclipse can do it!

 

With the following code snippets:

 

Car.php

<?phpclass Car {    public function get_type() {        return $this->type;     // reference OK    }    public $type = 'ferrari';}class Engine {    public function running_in() {      // in same file        $car = new Car();               // of course this can ref Car        echo $car->get_type();          // of course this ok too        return $car->type;              // of course this ok as well    }}?>

Driver.php

<?php//include 'Car.php';        // works even without include$car = new Car();           // reference OKecho $car->get_type();      // reference OKecho $car->type;            // reference OK?>

Although this is a good news. Yet I still want to know why people says Eclipse PDT cannot reference across files? Is there any misunderstandings, that I am implementing it wrongly?

 

Also, as many people say, Eclipse is slow because it is Java based. I am ok with the speed. But I still want a comparison list of features of different Web Dev IDE.

 

Thanks for any input about Web Dev Tool discussion!

 

P.S. In addition, JavaScipt list of methods with browser supporting versions (like what Aptana has) would be a very nice feature too!

Edited by midnite
Link to comment
Share on other sites

My particular peeve is that the dot-method "intelli-sense" doesn't help you get started. Need to parse a string into a real number? In Javascript you parseFloat(), and in Java you Double.parseDouble() and in C# you Double.Parse() and in Php you floatval().

Link to comment
Share on other sites

Thanks DaveJ for reply. What do you mean? In fact I can code well in Notepad++ or even Notepad. But as I would like to make my JS and PHP go OO, build some objects like i did in Java, an IDE with cross-files referencing would be very very handy (esp eliminate many misspells).

Link to comment
Share on other sites

I don't understand the "cross-files" problem you are describing. Classes are usually defined in their own files. When you instantiate an object in another file in any IDE (Netbeans, Elipse, Visual Studio, etc...) it will know to look up the class definition in the other file and provide the "dot-help."

 

These IDE's will certainly support Php OOP, although perhaps there are limitations. I don't know about JS.

 

What I am describing is the need for a quick language look-up. You can say to yourself "OK, I want to parse this string into a floating point number" but you can't remember the proper syntax, because as I mentioned above, they are similar but different across various languages.

Edited by davej
Link to comment
Share on other sites

Thanks DaveJ. What am I looking for is exactly the feature you mentioned in your first paragraph. Yes it seems to be a must-have feature for every Java IDE. But for PHP and JS, some IDE cannot do this. They can only look up the class definition within the same file.

Link to comment
Share on other sites

I would have to experiment with these IDE's and test what they do. I have used Netbeans for Php but I'm sure it was not OOP. In Java you tell Netbeans each time you are creating a class, so it isn't just a file -- the IDE knows it is a class, so that should also work with Php.

Link to comment
Share on other sites

Thanks DaveJ. Yes it is tricky for both PHP and JS, as the classes are not really related to the files. I have tested for a few versions of Eclipse. Most of them can cross-files reference PHP. But when it comes to JS, it depends (will be explained later).

 

While testing different IDEs, i particular like the Aptana or the Eclipse with the Aptana plugin, which it provides "level of support for each element in the major web browsers" in its content assist (works for both PHP & JS): (Does Netbeans have this?)

S3-1-lrg.png

 

Let me sidetrack a bit. As fas as i know, there are 3 ways to define classes (objects) in JS:

 

A) using var o = {}

var o = {  field: "...";  method: "function() { /* ... */ }}

B) using function() {}

function f() {  this.field = "...";  this.method = function() { /* ... */ };}

C) using var a = function () {}

var a = function () {  this.field = "...";  this.method = function() { /* ... */ };};

However, neither Aptana nor Eclipse with Aptana plugin can cross-files reference objects defined by method B and C. Both of them only work for method A.

 

On the other hand, Eclipse with the JavaScript Development Tool (JSDT) plugin, or Eclipse with the PHP Development Tool (PDT) plugin, they only work for method B and C. In addition, they cannot show browser version support in the content assist (as they are not Aptana).

 

As a result, i have to use both Eclipse + Aptana and Eclipse + JSDT for a complete function. Using two IDEs at the same time is not convenience.

 

In conclusion, a perfect IDE for me would be:

  1. Cross-file reference for both PHP and JavaScript (for all methods #A #B #C).
  2. Showing browser version support in the content assist.

(1 would be the priority, 2 is the second most important though.)

 

Note that, in my tests, no Eclipse version can satisfy #1.

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...