Archive for June, 2007
Overview
I have been playing around with a multitude of editors, and plugins over the several years that I have been doing web development, always searching for the next best thing, I have been through more editors than I can count of all different types; vim, jEdit, phpED, Zend Studio, Dreamweaver, and many more. For a long while I stayed clear of Eclipse, it always seemed to be a bit bloated for my tastes, I can admit now I was a little quick to jump to conclusions. The more I developed in a number of languages the more I realized I wanted to use one editor for all of them, Eclipse continues to grow and adapt to the ever changing development community. It has a number of useful plugins that do everything from add support for additional languages, revision control, to integrating directly with a number of issue trackers.
Limitations
Eclipse does however have limitations in my view. One of the things I dont like about Eclipse is that common functionality between editors can be limited, each language implements its code folding in a different manor, that is however if they implement it at all. I think some of this functionality could be exposed on a generic level. For instance, maybe a general preference to enable folding on tabs, or brackets { }, brackets are common in most languages to define blocks of code, it would be useful to have this functionality available by default in the editor for unsupported types, the ability to fold on tabs is huge for me, a lot of code no matter the syntax people generally keep a manor of spacing to define blocks clearly, to be able to fold on those makes it easier to view what you want, this is one of the features I miss most about jEdit, other functionality I miss about jEdit was its ability to expand a fold into the full buffer, let me explain this more in detail, when folding was implemented you had the ability to select a fold and show only that block of code in the editor window, which stops you from over scrolling the block of code you need to focus on, and finally SuperAbbrevs; Eclipse does have functionality like this available for Java, but I think this is another feature that could be implemented in all editors generically, what this plugin did was allow you to define tags, that when typed and a key combination was entered it would replace it with your abbreviation (code template) I’ll show you a brief example
I would define an abbrev like this for the value “fore”
if(is_array($${1:array})){
foreach($${1:array} as $${2:key} => $${3:val}){
$end
}
}
Now inside my editor if i typed “fore” and pressed the hotkey it would output the following and i would already have selected “array” inside $array. As i type it would replace the value in both sections, upon pressing tab i move to the next variable “key”, then “val”, and the final tab would put my cursor inside the foreach loop.
if(is_array($array)){
foreach($array as $key => $val){
}
}
Defining helpers like this can reduce your development time a lot and enforce good practices.
These are only a few pieces of functionality I feel Eclipse is lacking to make me a truly happy man. Over my time doing web development I have found a number of useful plugins to Eclipse, I will discuss some of my favorites I use on a daily basis below.
Revision Control
I’m a big supporter of revision control, and I believe that it is a necessity for any serious developer, it can save you a lot of time tracking down issues that may have been introduced in new code, rolling back changes to get rid of features, or bugs. It also simplifies the development in groups of more then one user, but this could be an article all in itself about all the benefits to source control.
The two revision control systems I commonly work with are Perforce and Subversion, both have plugins for Eclipse, P4WSAD for Perforce and Subclipse for subversion, these allow you to interact with your repository without ever needing to leave the development environment.
PDT - PHP Development Tools
PDT although not officially released till September of this year is currently in a Release Candidate state, and an extremely powerful tool for PHP developers. I use the plugin on a daily basis.
- Support for PHP 4 and 5
- Syntax Highlighting
- Syntax Validation
- Code Folding
- PHPDoc Support
- Code Completion - This reads PHPDoc as well and displays this information when the content assist drop down appears, supports PHP’s native functions and show descriptions and parameters.
- Code Outline
Aptana
I have only recently started playing with Aptana, but I am extremely impressed with it thus far, I know I have probably only scratched the surface of the functionality it offers; and same as PDT this is still in a pre-release state so plenty of functionality to come, Although Aptana does provide PHP support I am incredibly fond of PDT and have been sticking with that, rumor has it 1.0 release of PDT will incorporate the HTML / CSS / Javascript support from Aptana, One can only hope. I am only going to address features I have personally used.
- Javascript / CSS / Javascript Syntax Validation
- Javascript / CSS / Javascript Syntax Highlighting
- Code Folding
- Code Completion - the amount of code completion this offers is insane, it will code complete your user created javascript functions, CSS will code complete your tags by id if you type # in the document, after setting in your preferences which browsers you want to support code completion will also show you what browsers support the CSS attribute, or javascript function it is suggesting, javascript code completion will also tell you what versions of the DOM support it.
- Outline view
- Javascript debugger
- FTP / SFTP support
Mylar
Another useful plugin that I have only recently just found. Even the name of it is creative, for those that don’t know mylar is a polyester film that is used to make inexpensive viewing glasses uses to look at solar eclipses, it keeps the eclipse from blinding you, Mylar does the same thing, it keeps you from being blinded from Eclipse. Mylar is a task based view of Eclipse, when looking at your project structure, your outline, or even the code unfolded there is way to much to look at. This plugin allows you to create tasks, which have a context associated with them, it keeps track of what you do when you have this task activated, and limits the views in the project explorer, the outline view, and the unfolding of code to only the pieces you have interacted with while you have had this task activated. You have the ability to set portions of code to a higher priority, remove files from the context, or clear the context all together. This plugin comes in extremely handy for me in my day to day work, as things of higher priority always come up, I just create a new task and move on, then when i’m ready to go back to what i was doing I reactivate my old task and it brings up any files I was working with and limits the views to only what I was looking at.
The functionality doesn’t end there. It integrates into several issue trackers already, Bugzilla, Trac, and several others. So your tasks are automatically pulled from your issue tracker and you can close out the tasks right there without leaving your IDE, and also allow you to associate a context with it. Even if your issue tracker isn’t supported a feature that proves to be extremely useful is the ability to import / export contexts. So if I work on a defect and pass it along to another member of the team I can email him my context, or attach it to the defect, So he can work with what I already have.
Conclusion
Eclipse is a very powerful tool for web developers to have available, and the plugins for it continue to get better. I know I have only scratched the surface of some of the plugins I use regularly, and I know there are many more plugins I dont even know exist.
So I decided to move my blog, it was hosted on Alakriti but i’m working on migrating my personal stuff to its own site, to make room for business only stuff to be on Alakriti. So over the next few days I will be importing some of my articles from my various blog and getting this thing styled more to my liking.
Fair warning some posts will end up before this one, as I am going to date them to the date they were posted for historical tracking.
