Page 1 of 1

Intellisense VS Autoloader

Posted: Wed Oct 18, 2006 11:27 am
by Hurreman
During the past years, my collection of code has started to grow, and I find myself quite often tabbing between files when I don't remember the exact order of a few function parameters, or a function name.

So the other day I started looking for a PHP IDE with Intellisense (after playing around with Visual Studio at my new job), and I found one in particular that I liked (TSW WebCoder).

"Great! Now I'll speed up my coding with xx%", I thought. What I didn't keep in mind, was how my current projects are being built.

On my latest couple of projects, I've been using a Frontloader/ServiceLocator mix, which loads the class-files whenever they're needed. This way, I don't have any static include-files, which I thought would make everything a bit cleaner and faster to use when expanding my projects.
But the downside with this method, is that IDE's with intellisense won't load dependencies or includes unless they're being included directly via include() or require().

So here I am, trying to choose. Re-write my future projects to use static includes, which enables intellisense, OR stick with my "autoloader" (which even has a few problems passing multiples parameters to functions in a nice way)...

I'll probably end up rewriting a lot of my code, since I guess loading dependencies with include_once() or require_once() on every page won't create all that much overhead until my projects end up being, well, huge.

does anyone agree/disagree? Post your thoughts :)

Posted: Wed Oct 18, 2006 11:36 am
by feyd
I can tell you that Eclipse doesn't need explicit inclusion to know about IntelliSense like materials.

Posted: Wed Oct 18, 2006 11:45 am
by Hurreman
Ah. I never thought about trying eclipse. I always got the impression it was a expensive product, but I appear to have missed something.
Thanks feyd, I'll check it out!

Posted: Wed Oct 18, 2006 11:55 am
by feyd
It's free.. that's the best kind of expensive. :)

Posted: Wed Oct 18, 2006 12:01 pm
by Luke
I didn't know it was free either... thanks man!

Posted: Wed Oct 18, 2006 12:16 pm
by Christopher
Not only is it free, but there are two different PHP IDE available for Eclipse. There is the older PHPIDE and the new Zend one.

Posted: Wed Oct 18, 2006 12:30 pm
by Hurreman
Checking it out a bit atm. I kind of like it, and get the feeling that it can be customized for everyones individual needs and preferences.
It doesn't seem to have a built-in database browser and query editor like TSW WebCoder had, but perhaps I just havn't found it yet :)

Posted: Wed Oct 18, 2006 1:16 pm
by feyd
That's what plugins are for, friend. :)

Posted: Wed Oct 18, 2006 1:33 pm
by neophyte
Where do you get the new Zend plugin? I've got PHPEclipse. But I've never done anything with the Zend extension.

Posted: Wed Oct 18, 2006 1:35 pm
by feyd
neophyte wrote:Where do you get the new Zend plugin? I've got PHPEclipse. But I've never done anything with the Zend extension.
Your Google powers are diminishing. :P

http://www.zend.com/phpide/

Posted: Wed Oct 18, 2006 1:45 pm
by Hurreman
I just ran some tests through the different PHP IDE's I found that have intellisense.
First, I created two basic classes:

Code: Select all

<?php
class foo
{
    public function __construct()  {
    }

    public function getBar() {
        return new bar();
    }
}

class bar
{
    public function __construct() {
    }

    public function printVal() {
        echo 'Value';
    }
}
?>
Then, to see how smart the programs were, I added

Code: Select all

<?php

$foo = new foo();

// Here, after writing $foo->, I get a list containring getBar(), just as it should be.
$bar = $foo->getBar();

// And here it gets stuck. I write $bar->, which theoretically should suggest printVal(), but it doesn't.
$bar->
?>
So, it seems to me that the intellisense implementations are pretty limited. But then, it's been ages since I coded using VC++, so perhaps this is just the way it works. For now, out of the four IDE's I've tried since yesterday I prefer TSW WebCoder. I guess it just looks familiar to VS2005.

Posted: Wed Oct 18, 2006 2:11 pm
by feyd
VisualStudio's is generally superior, but it can depend on the plugin's own coding too, I'm not entirely sure where Eclipse stops and the plugin takes over. I suspect that the entire workspace is run mostly by the plugin, which may or may not give control (or information to) Eclipse itself when attempting to find contextual information.

Posted: Thu Oct 19, 2006 2:05 am
by jmut
in Zend Studio the autocompletion you need is implmented like this.

Code: Select all

<?php

$foo = new foo();

// Here, after writing $foo->, I get a list containring getBar(), just as it should be.

/* @var $bar bar */       // <<<<mind the comment

$bar = $foo->; //...(outocomplete will work here...will show printVal())

?>
So you can try these...might work with IDEs you mentioned.

Posted: Sun Oct 29, 2006 7:49 pm
by n00b Saibot
You might want trying Visual Studio.PHP IDE. Its a PHP IDE integrated into your VS.NET IDE. How nice but comes for a price.