Tag Archives: Eclipse

IDE: Why Use One And Which To Choose

Everyone wants to be more productive, make fewer mistakes and write good code. But in most cases IDEs help us to achieve those goals more easily. Unfortunately, choosing the right IDE is very difficult because a lot needs to be considered. And the website of almost every IDE tells us it is the best one.

We’ll take a close look at the most popular PHP IDEs, exploring their functions, comparing them in a table and drawing some conclusions. Hopefully, you’ll get an idea of what each PHP IDE has to offer and which one best fits your needs.

The following are some of the features that I found needed to be considered.

IDE Features

1. Syntax highlighting

Good syntax highlighting improves code readability a lot. Really! Just look at this:

Syntax Highligting

2. Code completion

Automatic code suggestions can help the developer avoid having to type so much. If it supports custom classes and phpDoc, it can even save you from having to read project documentation.

Good code completion can also prevent typos. For example, if typing $cotroller-> does not show you any suggestions, you’ll know something is wrong. Uh oh… it should be $controller!

Poor code completion can slow you down if too many variants are shown or your class methods are not picked up.

code completion

It is also good to have file name completion in HTML src=” and PHP include and require.

3. Navigation

One of the most boring things is trying to find where a certain variable has been defined or used. Some good IDEs can help with “GoTo” actions, like go to definition.

Another important feature is search. Searching should not take a long time, even with large projects. Even better is if the IDE lets you move quickly to the next occurrence of a search phrase, like Firefox does with its Quick Find feature.

Navigation

4. Errors and warnings highlighting

On-the-fly syntax checking can prevent various typos and common programming mistakes. In the example below, the IDE indicates that you may have used = instead of ==:

errors

The more the IDE detects, the better — except false positives, of course.

5. Refactoring and code generation

Refactoring is basically a set of techniques for turning weak code into solid code. Its implementation in PHP IDEs is very weak compared to that of compiled-language IDEs, such as Java and C, but it’s still very useful.

Very basic PHP refactoring includes:

* “Move,” which updates all includes and requires when moving a file to another directory.
* “Rename,” which renames something and ensures it is renamed throughout the project.
* “Safe delete,” which ensures deletion of a file does not harm other parts of the project.

refractor

In addition to basic refactoring, some IDEs can generate code for class constructors, getters/setters and even stub methods for a parent class.

setter

6. Debugging

Debugging is not so critical in PHP because you can add echos or use something like FirePHP without even having to recompile your code. But for complex applications in which you need to add echo after each line to see what’s going on, debugging can save you hours.

debugger

If the IDE is good enough, it provides you with step-by-step debugging and lets you see the current values of variables in scope.

7. Versioning system

Versioning is extremely useful for both team and one-person development. It shows what changes have been made to a file, when they were made and by whom. A good IDE allows you to visually compare revisions, copy changes from one version to another, revert to previous states and merge changes made by different team members.

versioning

When performing common checks and commits, integrating a versioning system such as CVS, SVN, git or Mercurial in your IDE is usually much better than running a separate application.

8. Client-side features

Using PHP alone is very rare. CSS and JavaScript are almost always somewhere in your application. So, good code completion, highlighting, navigation and perhaps some refactoring would be just as beneficial for the other languages and technologies you use in conjunction with PHP.

code completion

Every IDE provides a lot of features. Some of those features are very useful, some are not. Here are some guidelines to follow to narrow down the one for you:

* Try free ones first. Their feature set may be enough for you, and you wouldn’t need to pay for a license.
* First, make sure the features you want are ones you really need. If they are, check that they work properly in your IDE of choice.
* If you find one IDE that fits well but is missing one or two features, try specialized tools.
* Once you choose an IDE, play with it for a week before implementing it in a big project. You may find your current working habits are too strong to allow you to feel comfortable with it.

Conclusion

Both PDT and NetBeans are good. If you need a lot of plug-ins, Eclipse is the better choice. If editing tools and code completion are more important to you, then pick NetBeans. NetBeans is a bit more responsive, too.

If you are mostly editing HTML and CSS, try Notepad++, vim, TextMate or Emacs. They all have very good HTML editing capabilities and can be configured for simple code completion. And they are faster and lighter than fully featured IDEs.

If you are editing complex JavaScript, try Aptana, which is amazing for JavaScript, or the Spket plug-in for Eclipse, which has nearly the same features.

And remember, IDEs are not meant to change the way you think. They simply speed up the development process.

Top 10 tools for java development

As a java developer, we always trying to get someone else to do little jobs for us.  This is a list of tools (and possibly frameworks) that we have found most helpful in any java development.

  1. Eclipse (http://www.eclipse.org) – everyone should know what eclipse is by now. The reason we include it here is mostly due to the refactoring support is immensely helpful.
  2. Ant (http://ant.apache.org/) – again, everyone should know this tool by now. Ant is a fantastic build tool, but allows you to do much more with all of the extension support. We have seen some very cool things done with ant, ivy and a few custom tasks.
  3. JUnit (http://junit.org/) – people should know this framework, but many people still don’t subscribe to the automated unit testing model. I find automated unit tests a great way to ensure you haven’t broke anything mainly because I regularly break my own tests.
  4. Tomcat (http://tomcat.apache.org/) – Tomcat is obviously more useful if you are doing web development in java. Duh. However, if you do any of that and have tried configuring something like WebSphere, you can understand why I include it.
  5. Sitemesh (http://www.opensymphony.com/sitemesh/) – Sitemesh is one of the simplest web presentation frameworks I have seen. It can be seen as a basic template engine, but quite often that is all that you need. The difficulty with most web frameworks is that they try to be all things to all people. Sitemesh just wants to put a nice configurable template around your content. The idea of “do one thing and do it well” comes to mind.
  6. Spring (http://www.springframework.org/) – Spring is one of the “web” frameworks that tries to be all things to all people. However, it doesn’t do a bad job. If you are involved with a large project, Spring gives you some nice functionality out of the box without having to go the coding standards route.
  7. Ivy (http://ant.apache.org/ivy/) – Well, some things have changed in Ivy-land. It is an ant subproject now and soon to be moving to the ant site. This might be a good thing. Ivy is a dependency management tool that can be used with ant. If you have more than one small project, you are likely to need dependency management. I like it because I am not required to move to Maven which I have not had much success with.
  8. Luntbuild (http://luntbuild.javaforge.com/) – Luntbuild is an open source GUI build management tool. So, you already have your ant builds and they can be integrated with luntbuild. The bonus with luntbuild is that you can have separate development, qa and production configurations for the build. There is also a professional version called quickbuild (http://www.pmease.com/) that comes with support and some additional features.
  9. Cobertura (http://cobertura.sourceforge.net/) – This is my favorite code coverage tool, mainly because it works and it is free. Code coverage is a good metric to have because it will quickly show you where you have less tests. You will never hit 100% coverage (and you shouldn’t), but it is a good benchmark to look at, especially if you get some defect density numbers from your code as well.
  10. Xerces (http://xerces.apache.org/) – Is there any other XML parsing library out there?

If we have missed your favorite tool, let me know and I will try to look into it. I am always on the lookout for new tools that can improve productivity.