Intellisense VS Autoloader

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
Hurreman
Forum Commoner
Posts: 61
Joined: Sat Apr 29, 2006 8:42 am

Intellisense VS Autoloader

Post 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 :)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I can tell you that Eclipse doesn't need explicit inclusion to know about IntelliSense like materials.
User avatar
Hurreman
Forum Commoner
Posts: 61
Joined: Sat Apr 29, 2006 8:42 am

Post 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!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

It's free.. that's the best kind of expensive. :)
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

I didn't know it was free either... thanks man!
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post 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.
(#10850)
User avatar
Hurreman
Forum Commoner
Posts: 61
Joined: Sat Apr 29, 2006 8:42 am

Post 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 :)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

That's what plugins are for, friend. :)
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

Where do you get the new Zend plugin? I've got PHPEclipse. But I've never done anything with the Zend extension.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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/
User avatar
Hurreman
Forum Commoner
Posts: 61
Joined: Sat Apr 29, 2006 8:42 am

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Post 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.
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post 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.
Post Reply