Saturday, May 14, 2011

What is an IDE

In short, an IDE provides a one-stop shop for your coding work. An IDE contains an editor in which you can edit the code, debug the code, view your code in a browser (often embedded), and check in and out of source code control. To support that functionality, an IDE has a set of features you don't find in a basic editor, such as Notepad or Vim. Again, you can extend editors to do a lot of these things, but IDEs have all this functionality in one tidy package -- typically preconfigured:

Projects
A key distinguishing feature of an IDE is that it looks at a PHP application as a project, not just a set of files. That containing concept -- the project -- maintains extra information, such as the configuration of the source code control, the database settings for debugging purposes, and the location of certain key directories.

Debugging
Another handy feature is integrated debugging. With this functionality, you can set breakpoints in the editor at which the PHP interpreter stops during execution of the script. From there, you can inspect the values of local variables to diagnose issues in the code. It's a healthy alternative to sprinkling echo statements through your code to check values or using the error log to get the values of variables.



Code intelligence
PHP is a very regular programming language, which means that it follows simple patterns. Not only do these patterns make it easy to write, they make it easy for an IDE to inspect the code in your project. In addition, they help you while writing by displaying the results of their inspection. For example, if you define a class with the name MyClass in your project, the IDE then provides a pop-up window that includes MyClass as an option as soon as you type the keyword new. As you use the object of that type, the IDE shows its available methods and instance variables. When you start typing a function call, the IDE helps you by displaying the available arguments. Honestly, this is the No. 1 reason you should use an IDE and not a text editor. This type of code intelligence can save you hours of mistyped class names, method names, and wrong arguments.

Class view
A side effect of having a code intelligence engine in the IDE is that the IDE can produce a class view of the project. Instead of showing the files, the system can show you the different classes you have defined, regardless of the file they're in. As you click the classes, your editor is taken to that file and the selection placed on the class, method, or instance variable. It's a much nicer way of navigating around big projects.

Support for multiple languages
Each IDE covered here supports not just PHP but a collection of the related languages: JavaScript, Structured Query Language (SQL), Hypertext Markup Language (HTML), and Cascading Style Sheets (CSS). Support for HTML and CSS are often the best, because it's simpler. The support for JavaScript often comes down to syntax highlighting, but something is better than nothing.

Source code control
All the IDEs evaluated here support some connection to a source code control system, which allows you to maintain versions of the files in your project over time. You can mark particular versions of the files as a release, then revert to them when you want to roll out changes you've made. It's critical in team environments to use a source code control system, but it's important for individuals to use one, as well. A good source code control system can save you when a disk blows up or when the customer suddenly wants the version before last, rather than what you have today. Most of the IDEs support Concurrent Version System (CVS) and Subversion, which are open source control systems. One IDE supports Perforce, a commercial source code control system.

FTP/SFTP integration
Related to source code control is the ability to use FTP for the most recent code to the server. This is a lot easier than using an FTP client or packing up the files yourself, sending them to the server, and unpacking them.

Database navigation
A helpful but not essential feature is database navigation. With this feature, you can browse the database your application talks to, find out the table and field names, and run queries. Some systems even automate writing some of the database access code for you.

Integrated Web browser
Some of the IDEs support an integrated Web browser that can navigate directly to the page you're editing with additional arguments you specify, the browser being hosted within the IDE or invoked externally. To be honest, I'm not a huge fan of the integrated browser because I don't mind switching between editing the code and viewing the result in two separate applications. But I can see the attraction, and it's not required that you use it.

Snippets
The last feature I found in all these IDEs was support for both canned and custom code snippets. Snippets are little fragments of code that perform small tasks, such as running a regular expression on some input, connecting to the database, and querying the database.

That sums up the core features you can expect from a purchased or open source IDE today. From here, we look at some popular IDEs. We'll show some pictures of what they look like; and explain what they support, and how much they cost, if anything

No comments:

Post a Comment