I started looking for a PHP IDE again to replace the venerable TextPad. Last year I looked at NuSphere’s PhpEd, which was actually not bad but I couldn’t bring myself to spend $100+ on it just to get a little Intellisense. Now I’m looking at Eclipse with PHP Development Tools (PDT), which is free and open source.
CORRECTION: I’m told that Eclipse is open source but it’s somewhat commercially developed. It’s all described on Eclipse’s About Page.
The version I’m looking at is Eclipse 3.4.2 and PDT 2.0.0. And note that I don’t know where Eclipse ends and PDT begins, or vice versa. Throughout this post I refer to Eclipse or PDT, but I might actually be talking about PDT or Eclipse, respectively. I gather that Eclipse is the “engine,” which I presume includes a basic text editor, and PDT is the set of extensions that provide PHP-specific functionality.
So far it’s not bad. Eclipse does run fairly well for a Java app, which is in contrast to most Java apps I’ve seen. (The only other Java app I’ve seen that really impressed me was Azareus (now Vuze) which used to have a very impressive-looking interface… now it’s rather bloated, but that’s a different topic.)
I can definitely say that it beats TextPad as far as PHP development functionality is concerned.
I realize I probably shouldn’t do this, since they are aimed at two totally different developer audiences (Microsoft developers vs. everyone else), but it’s hard not to compare Eclipse with Visual Studio, which I still consider to be the IDE to beat. (For me, at least: I’ve been using Visual Studio since around version 5.) VS gets bigger and slower with each new version, but it still has a pretty impressive set of features.
(Side note: The only other IDE I’ve used with any regularity is Xinox Software’s JCreator, which I thought several years ago was a decent Java IDE, and worth the nominal fee I paid for it. Other than that, I’ve used mainly TextPad for PHP development and Visual Studio for everything else.)
I’ll start with some pros before I get into the cons.
I love that you don’t have to install Eclipse. You just unzip it into a directory and run it, just like that. (Not counting Java runtime installation.) Life as a Windows user would be so much better if more applications worked like that. (That is still one of the biggest things I miss about the Amiga to this day.) Visual Studio, on the other hand, takes several man-years to install, patch, and get running.
Eclipse’s Open Resource feature, or CTRL+SHIFT+R (which Red pointed out to me), is pretty awesome. I am constantly struggling to remember where files are in the project hierarchy, and I almost always have to fumble around in the Solution Explorer (aka. PHP Explorer in Eclipse) to find things. When projects get really big, that becomes a surprisingly large impediment in my workflow. So the idea of being able to open any file by typing the first couple of letters of the filename is pretty cool. (UPDATE: I went searching and found a Visual Studio add-in that has similar functionality: Koda.)
I like that Eclipse reads “TODO” comments and puts them into a task list for you. That’s a feature I use a lot in Visual Studio, so I’m glad to have it in PHP development.
UPDATE: It occurred to me that the ability to see syntax errors in the editor is a major plus for PHP development. With plain old TextPad, you have to load the page before you can see syntax errors, which is rather time-consuming.
The terminology in Eclipse is very different from Visual Studio. You’ll have to learn what workspaces and resources and views and perspectives are. It’s not difficult, but some of it doesn’t feel very intuitive. To me, there’s not much difference between the words “view” and “perspective,” yet in Eclipse, they are entirely different things. (Also, a “view” in Eclipse actually seems a lot like a “window” to me, and a “resource” looks suspiciously like a “file.”)
Initially it’s somewhat frustrating to work in Eclipse after using Visual Studio for so long, because of the operation of Auto-complete (aka. Intellisense). In Visual Studio, I’ve become entirely accustomed to pressing TAB to make selections from the dropdowns, but in Eclipse, you have to press ENTER. (Come to think of it, I think JCreator also used ENTER.) Maybe I just need to stop using TAB in VS – it turns out that ENTER also works (along with a slew of other keys). Unfortunately, because of the physical location of the keys, pressing TAB with the left pinky after using the arrow keys with the right hand feels much more efficient and comfortable to me than stretching a finger to press ENTER after using the arrow keys both with the right hand.
The Eclipse editor seems fine, but there are subtle differences from Visual Studio that cause me to do some extra backspacing sometimes. Minor things in the areas of auto-indentation and tabbing. A lot of times I press enter at the end of a line and the cursor moves over someplace I wasn’t expecting. Nothing that I couldn’t get used to, though.
Except for one thing that I found kind of weird: For PHP, I use tabs set to 2 spaces. When I hit tab in Eclipse, it always seems to move the cursor over exactly 2 spaces, even if you’re on an odd column, so sometimes I find that my code is one column off. There may be settings to change that behavior, but I haven’t found them yet. (The number of settings in Eclipse is even more bewildering than those of Visual Studio, if you can believe that.)
The Eclipse editor also has a puzzling habit of highlighting things for no apparent reason (see screenshot below). If I click on, say, the $plugin variable, it highlights all the other instances of $plugin in the code, too. Sometimes in a different color. I’m sure there’s a reason for it, but I can’t make heads or tails of it. It’s sort of distracting, actually. Maybe it would make more sense if I could right-click on one of those highlighted variables and find some kind of clue about what to do in the context menu. (UPDATE: Oh, it’s called “Mark Occurrences” and all it seems to do is highlight occurrences of whatever you select. Thankfully you can turn it off from the toolbar.)
I don’t understand Eclipse’s search feature at all. I can’t seem to get it to perform the simple task of finding a string in the file I’m editing. Like, say, a variable name. It always seems to want to search every file on disk or something.
It looks like the Find/Replace window is actually what I want… except I didn’t want to replace anything. I guess the two operations are built into the same window, which makes perfect sense from a programming perspective but seems odd from a usage perspective. (Find and Find/Replace have been two distinct tasks since the dawn of computing, as far as I know.) So I suppose I’ll need to bind CTRL+F and CTRL+H to the same function.
All of the above leads to my biggest gripe with Eclipse: It’s lacking quite a bit in the area of polish, especially in the menu structure. I don’t want to get off on a commercial vs. open source rant here, but Eclipse demonstrates something I see a lot in “mature” open source projects (especially ones coming from Linux): A sort of entropy sets in when, during development, a bunch of different people add different things to the menus in what looks like completely random order, and several years later you end up with 50 different menus with 50 different sub-menus and no real organization or structure. I bet most of the menus probably aren’t even useful except in obscure cases. It might make perfect sense to anyone whose been using Eclipse all along, but to a brand new user it seems pretty mysterious and, well, kind of unprofessional.
For example, when I highlight a method in the editor and right-click for a context menu (see picture below), why on earth do I see things like Run As and Preferences? What does that have to do with the text I just highlighted? To me that’s a sign of a rush job, programmer laziness, poor attention to detail and/or lack of project management. (All of which are typical of community-driven projects.)
And here’s something else on the same context menu that makes one think twice about using a product. Will the real Apply Patch please stand up?
(Yeah, yeah, it’s open source so I can easily fix it, blah, blah, whatever. That’s just a lame excuse for poor craftsmanship. Don’t release the product until it’s ready… it’s not like you’ve got upper management breathing down your neck to meet a deadline.)
One thing I was hoping to find in PDT was a Refactor option like Visual Studio’s. The kind of thing where you can just rename properties and methods and it will go and automatically change all the references in the project for you. Since Visual Studio 2005, I’ve come to use that feature almost compulsively during C# development. I’m sure it would be challenging to implement reliably in a PHP IDE, but it sure would be nice.
PDT also does not include any way to FTP files to a server, which is kind of a bummer (PhpEd did, and it was pretty nice to be able to hit a button and upload changed files). Supposedly that functionality is available from another Eclipse plugin called Target Management (Remote System Explorer), but I haven’t had a chance to look at it yet. Just from reading the overviews it seems entirely too powerful (ie. complicated) for my needs, and I’ll probably just stick with FileZilla.
Surprisingly, Eclipse consumes roughly twice as much memory (or more) as Visual Studio 2008. Also, it has a disturbing habit of not closing itself down completely. Sometimes I have to go into Task Manager and kill the eclipse.exe process before I can run it again.
So to wrap up this lengthy rambling, Eclipse with PDT is rough around the edges but it’s certainly better than a plain old text editor to manage PHP projects. But if you’re a full time PHP developer and you have some money to spend, I can’t honestly say it’s better than a commercial IDE. I plan to keep using it, though, unless something really bad happens (like it accidentally trashes my source code or something).