January 22, 2008

Zend Studio weds Eclipse

Author: Peter J. Manis

With today's release of Zend Studio for
Eclipse
, Zend has made Zend Studio, which we reviewed last year,
even better.

This release of Zend Studio introduces a number of terrific features and as a whole provides you with the most feature-rich
release of Zend Studio to date. One of the notable features is Zend's use of the Eclipse as the base platform. Eclipse is by default a Java IDE, but should be looked at more
like a platform or framework. Primarily written in Java and used by more than 2 million developers, Eclipse allows developers to expand functionality with plugins and modules that provide functions such as syntax highlighting, code completion for other programming languages, and integration with Subversion or CVS. By using Eclipse, you can use Zend Studio when developing PHP pages, then quickly switch perspectives to Aptana to work on JavaScript and AJAX or to RadRails
for a Ruby on Rails project.

In this new release, which I tested late in the beta cycle, Zend
has integrated the Zend Studio technology with the Eclipse PHP Development Tools (PDT)
project. PDT has a large feature set and will continue to be available
for use, but Zend Studio adds a layer of features
that go above and beyond PDT
.

124687-3-thumb.png

Eclipse includes perspectives or views, and Zend takes advantage of
this feature in many ways. In the upper right side of Figure 1 you
will see PHP Profile, PHP Debug, and PHP, each of which is a different
perspective of the application, and has been setup to provide a wealth
of different information. Figure 2 shows the editor window with the
outline and file navigation for the project to the left. Below that is
a Remote Systems tab, task list, and a real-time display of any errors
or warnings found in the code. The Remote Systems tab (see Figure 3) allows you to
launch a shell on the local system, and browse local files and those
on the other end of FTP, SSH, and SFTP connections. Figure 1 shows the
profiling perspective, which breaks down execution time, the flow of
the execution, and much more. Other useful perspectives included are
Database Development and SVN/CVS Repository Exploring, both of which
allow you to browse the resources you may be interacting with.

After customizing a perspective you have the option to save it as a
custom view for future use.

The WYSIWYG perspective functions well. For instance, if you add a
meta tag to the head, regardless of where you drop it the tag is added
to the end of the head, as opposed to having one meta tag on the same
line as another. Zend Studio can detect CSS classes and display them
in a list for you to select from the properties tab. I did run into
some trouble when dragging and dropping elements in the source view. A
new element, when dropped behind an existing element, would end up
within the tag instead of in between the opening and closing tags.

Code completion seems more responsive compared to 5.5, and you are
still able to improve the code completion by using PHPDoc
documentation. You can see in Figure 4 that by taking advantage of
PHPDoc you can specify what type the input should be, a description of
the function, and what the function will return. This greatly improves
the productivity of new developers coming into a project, as they do
not have to look up what the function does or the parameters.

124687-5-thumb.png

One feature I can't get enough of is Local History (see Figure 5). Undo only goes
so far, and is lost if the application happens to crash. Even the use
of Subversion and CVS still leaves a gap, since you are not committing
changes every time you save the file. Local history works by creating
a copy of the file each time you save, and stores that file within
your local Zend Studio data folder. If needed you are able to compare or replace text from previous saves with ease. However, the
comparison should feature syntax highlighting, which it currently does not. There does not seem to be a way to search through the local history for a specific change, but changes can be grouped by the day they occurred.

Unit testing is becoming more popular in PHP, and Zend has added
features to both create PHPUnit test cases and suites and an interface
to analyze and run the tests. Using unit tests you can automate
testing your code in multiple scenarios. When creating the cases and
suites you are presented with a dialog that allows you to select what
you would like to test. After you've created the tests, right-click,
go to Run As -> PHPUnit Test, and Zend will display the PHPUnit tab
and give you a breakdown of all functions that passed or failed during
testing.

While testing the DebugDemo included with Zend Studio I wrote a
test that would guarantee to fail using the row_color function. The
following test passes the number 3 to row_color, and checks to see if
the returned value is 'white.' This fails because the number 3 would
return 'yellow.'

$this->assertEquals(row_color(3),'white');

PHPUnit tells us this fails and why it failed. In this case the
string 'yellow' was returned and PHPUnit was expecting a string
'white':

test_Row_color: Failed asserting that <string:white> is
equal to <string:yellow>.

Located on the menu bar under Window you will find Preferences; be
prepared for a lot of options. You can avoid going through every
option by using the filter box at the top. The software should run
fine without your having to change anything.

On both large and small projects, refactoring, which allows you to
rename variables, functions, classes, and includes, can be a huge
time-saver. For instance, if you need to move an include file,
refactoring allows you to easily do so and update all references to
that file to the new locations. Figure 6 displays a preview of
variable name changes. As of the beta 2 release you do not have the
option to refactor functions and classes when right-clicking the
element name within the Outline or Project Outline tabs.

Working within the system

Zend Studio uses IP port 10000 as the default for debugging. A
common application that already runs on port 10000 is Webmin; if you
use both Zend Studio and Webmin, you will need to change the port of
one of them. Zend Studio ran well under both Ubuntu and Windows XP,
which should make it easy for user's who are developing on multiple
platforms. It takes advantage of antialiasing settings within Ubuntu,
which makes it easy on the eyes with the right configuration.

Zend Studio also performs well when it comes to computer resources.
Under Ubuntu it uses in the range of low 200MB of RAM. Most modern
computers will run it fine.

During the review, I did run into some problems. Generating PHPDoc
files on Windows, Zend Studio stopped responding and php-cgi.exe was
terminated twice before the dialog window for PHPDoc would display. I
could not reproduce this problem on other machines. Zend Studio was
also unable to detect the use of Subversion or take advantage of the
features of Subversion when opening an individual file within a
working copy as some other IDEs do.

Overall, Zend has done a great job of improving upon an already
great IDE. The overall experience of working with the Zend Studio for
Eclipse was more pleasant than that of working with 5.5. Zend Studio is worth a try to see
if it is a good solution for you or your company.

Categories:

  • Reviews
  • Programming
  • PHP
Click Here!