After recently reviewing some development tools, we've decided to make PhpStorm our standard IDE for internal development of ocPortal. This blog post will go into a bit of detail of why we've chosen this particular tool.
Obviously any developer can use their own favourite editor. I'm a particular fan of TextMate because I like the low-overheads of a text editor (as opposed to an IDE) in day-to-day development across many projects and platforms. However, for some tasks, a fully-featured IDE really helps, and we really like PhpStorm.
The optionsThe best IDEs around nowadays are probably:
- Eclipse (or specialisations: Aptana / Zend Studio)
It's pretty easy to actually whittle these down in my opinion…
I love CodeLobster. It's speedy, and you can use it for free. However, it is Windows-only and this is not likely to ever change. In 2014 serious PHP developers should not be developing on Windows in my view.
Eclipse is horrible, almost anyone will agree, and I'll continue to rant about it through this post. Anything built on top of Eclipse is even clunkier because you get a poorly-integrated overall experience, and additional overheads.
KDevelop is Linux-only, and I'm on a Mac, as are many other PHP developers – but it's not really optimised for PHP anyway.
Netbeans is actually pretty decent, but still a little slow and clunky. It feels somewhere between PhpStorm and Eclipse.
phpDesigner and PhpEd are Windows-only, and nobody in their right mind would run important day-to-day desktop tools using Wine or a virtual machine.
So really this just leaves PhpStorm and Netbeans, or text editors combined with other standalone tools.
Code formattingWe've recently switched over to PSR-2 for ocPortal 10, which is the main motivation for standardising our tooling. We need a consistent way of auto-formatting our code, so that we can just keep re-running the code formatter across whole projects and know it won't keep shifting stuff around that we haven't been working on recently. PhpStorm is by far the best option for auto-formatting of code out there. I did have a shot with the best Open Source PHP code prettifier, which I won't name, but it actually added bugs to code, badly uglified some things, and missed out many important formatting areas. I was tempted to contribute to the project, because it does show real promise, but time is so tight nowadays.
I'm rather dogmatic about code formatting: I think it's important that developers view the consistent and clean layout of the whole code-base they are working within as an artform if they are going to exist in a mindset of applying quality everywhere. The human mind is not very logical, so while one can argue the code doesn't matter if it can be read okay, ugly code can really grate for developers and lower morale, and the sense of slipping standards can easily leak into more visible things. I've learned it's pretty much impossible to get developers to follow a particular set of coding standards, especially if they are working across different projects with different standards, so it's this non-ending source of frustration (and I know I'm not alone, seemingly trivial things are constantly argued about betweem developers). PSR-2 puts us more in-line with what other projects are doing, but more-over a standardised method of auto-formatting the code (i.e. in PhpStorm) allows me to pretty much forget about tedious code formatting and focus on more relevant things when reviewing code.
SpeedI think this has to be one of the most important things in an IDE. It tends to be the case that any desktop tool written in Java (as PhpStorm is) tends to be a bit slow and clunky to use, but somehow PhpStorm has managed to avoid this. Performance is really good. It's not as good as XCode or Visual Studio, which are native applications that tend to be a bit more optimsied to a more limited closed environment, but it's good enough to be comfortable.
I have a particular axe to grind with Eclipse. I find it slow and clunky, and buggy, and a general pain. I recently upgraded to a new machine, and a big reason is that having to use Eclipse (for Android development) was just a friction-heavy experience, especially on quite an old iMac.
So, PhpStorm is a real breath of fresh air for the kind of tool it is.
Other featuresI asked Amit (a relative newcomer to our development team), and his main observations were:
- Memory consumption was around 500MB during typical usage (so, pretty reasonable for a core tool when we now commonly are having 4GB or more of RAM)
- Automatic detection of version control, no need to configure anything for the git repository. Automatic adding of new files created inside folders to the version control system.
- Documentation (PHPdoc-style) is super easy, you just create your function with default values and it will generate the documentation along with the datatypes.
- The quick jump to another file works very effectively, the file list is nicely cached for high performance.
- Code formatter is "just awesome" to force the PSR-1/2 rules.
LicensingPhpStorm is commercial, so it naturally seems a bit unusual for us as an Open Source project to be standardising on it. However, they work with applicable Open Source organisations by providing free licenses, so we're going to be able to assign free licenses to the major core contributors to ocPortal. So this seems like a reasonable compromise to me, even if the idealist in me wants to have everything Open Source. Actually, when I research this more now I can see that the core platform (IntelliJ) is actually Open Source, but many of the features (esp. the PHP features) are still commercial-only. Google have been making use of the Open Source IntelliJ for their next version of the Android development platform.
I think, practically-speaking, some kinds of software are very challenging to maintain well under an Open Source model, and they'd have limited streams for monetisation (basically feature-sponsorship and donations), which I doubt would give them sufficient targeted resources to have a good focus on feature usability. Compare that to us, where we maintain whole projects around ocPortal on behalf of our clients. I wouldn't want to see PhpStorm to turn into a clunky monster (like Eclipse, LibreOffice, or GNU Gimp) . I can't see Eclipse being as speedy and attractive as IntelliJ any time soon, but it's great if I'm proved wrong here because of course there are other great benefits to Open Source, and I want to see Open Source projects succeed and win.