Team Development With Zend Studio For Eclipse: White Paper
Team Development With Zend Studio For Eclipse: White Paper
Technologies
January 2008
Table of Contents
Table of Contents ...................................................................................................................... 2
Introduction .............................................................................................................................. 3
Refactoring ..............................................................................................................................13
Introduction
PHP Development efforts generally start with a single developer or a small team with a similarly
small task. Projects tend to grow in both complexity and size as one good idea gets expanded
and enlarged into a web application.
As a project gains size and becomes more successful, development teams need to scale (or
should scale) to a larger number of developers at the same time. Further complexity often
arises as the application is deployed at many sites with different versions of the developed
product. One install may want special enhancements thus creating its own application branch.
The Problem
In order to grow business, a development company needs to increase both the number of
customer site installations and proportionately, the number of developers. Typical PHP
development efforts do not generally scale in both of these areas at the same time. However,
as your development team increases there are many aspects of development that should be
looked at more closely. Things like version control, team development environments, shared
code libraries, and common coding styles, just to name a few.
Many developers working on the same project can cause problems on a shared development
infrastructure since, as one example, an error introduced by one programmer has the potential
to ripple through the entire project. When something like this occurs all other developers may
need to suspend their work until the error is located and corrected.
In this paper we will be looking at the answers to the aforementioned issues within the context
of Zend Studio for Eclipse. We will be looking at many team development issues that can be
resolved by using this new Integrated Development Environment (IDE). We will be doing this
by posing common development scenarios and then discovering how Zend Studio for Eclipse
helps to alleviate the issues.
Zend Studio for Eclipse also integrates with the source control product known as CVS,
however the SubVersion product is the focus of the SCM discussions in this paper.
Scenario 1
Your development efforts are ramping up for you next version of your web application. There
is a development server that has just been setup with Subversion (SVN) source control software
and your team of 8 programmers is about to start their coding efforts.
Solution Discussion
Before you start to write any code you should take the time to sit down with the entire
development team and plan your approach. Your main issue here is that of coordinating the
development of code among your entire team. You would certainly not want to have days of
work potentially over-written by another programmer who is not aware of the work recently
completed by a programmer in a different office. Luckily in this situation you have some source
code control software installed to assist with this process. In this example, the tool is
Subversion so we will see how Zend Studio for Eclipse makes use of this connection.
you can control all the settings of Zend Studio for Eclipse. Specifically in this case, there is a
tree segment called Team and under that option is one called SVN. Here you can control many
aspects of how Zend Studio for Eclipse will interact with the SVN environment. This is shown in
figure 3.
Figure 5 - Using the Comment Template when Committing a File to the Repository
Now to get back to the checking out process of the files from the repository and creating your
own working copy we will set up an SVN project at the same time. This process is best
performed in the PHP perspective, so if you are following along with this paper, switch back to
the PHP Perspective and select new from the file menu and then select Other from the resulting
menu. This will open the New project wizard and from here you simply open the SVN tree item
and select “Projects from SVN” to begin the process. After selecting this option the wizard takes
you to the check out screen where it will display all the SVN repositories that it knows about
and has valid connections to so that you can choose which of them you want to make your
working copy out of. Once you select the source of your files to check out and name your
project, the actual checking out of the files begin. Figure 6 shows the checkout process under
way.
*** Commit
M C:/Documents and
Settings/Pbmacintyre/Zend/workspaces/DefaultWorkspace/Paladin-
bs.com_paladin/index.php
Committed revision 3
As you can see the Comment Template that was defined earlier is used here as well. Other
views that you should be aware of are: History, Synchronize, and SVN Annotate. Lets take a
quick look at these views and see what they provide to the developer.
NOTE: to open a view simply click on the window, show view, other menu sequence and the
list of all available view will be displayed. Some of the above mentioned views are under the
SVN tree and some are under the Team tree.
History View – If you click on the right-mouse menu while focused on a file in the editor and
select Compare With, then Latest from Repository, you will be switched over to the history view
with a new tab also opening in the editor view. What this process does is connects to the
repository and performs a line by line comparison with the file that is in your working copy and
the same file that is in the repository. Then Zend Studio for Eclipse shows you the results of this
comparison in the editor view area and at the same time displays some historical statistics in
the history view. A typical screen of this process is shown in figure 7.
Synchronize View - This view is used to help maintain the up-to-date status of the files that
are in your working copy. You can use it to verify that your working copy has the most recent
changes that are committed to the repository. If one programmer has been working on a file
and now its your turn to do some work, it is this process that you should run before you start
doing your own changes. To start this process simply right-mouse on the file in question and
select Synchronize with Repository from the Team menu.
SVN Annotate View – This view works hand-in-hand with the History view. Here you can
select an item of a files lineage from the History view and with the right-menu option of Show
Annotation you will be shown a listing of all the revisions that the file in focus has undergone.
You can then jump between “versions” of the file and view that code as it looked during older
revisions.
You have probably already found all the commands that are typical with the SVN software like
Commit, Update, Lock, and so on. These are all accessible from the Team menu after a right-
click on any file in either the code editor or the PHP Project Explorer view. The pop-up menu
with all its options is shown in figure 8.
Scenario 2
Many developers are now working on your third version of a successful web application. There
are 2 teams of developers, one team of 8 is in London, England and the other team of 12 is in
Toronto, Canada. The two teams are 5 hours apart and have to work on the same code base
that is housed on a development server at your head office in Phoenix, Arizona, USA that is
another 2 time zones west of Toronto.
Solution Discussion
Apart from all that you have learned about SVN in the previous scenario discussion, there are
still more team development features available in Zend Studio for Eclipse. Once you have
established a connection to the Source Code Management server (remember both CVS and
SVN are supported) from within Zend Studio for Eclipse your developers can begin the process
of version control and checking out and committing their work to the development server.
This ability alone can add so much stability and control to the development effort.
There are a lot of other team development options available to you within Zend Studio for
Eclipse. Let’s take a look at some of them now to see how they can be employed as part of the
local network development effort.
In the establishment of the Zend Studio for Eclipse development environment on each
developer’s machine you can use the export/import wizard to great advantage. As one
example, you can set up an entire development environment and have all the system wide
preferences exported so that all the developers can have the same development environment
(at least on the outset). You can even add that file to the SVN repository of the project so that
any changes that are made over time can be committed and used by the whole team.
As another example if you are in the process of debugging a segment of code you can export
your breakpoints and send them to the development team, then have the same debug
processes run through by the entire team just by having them import the contents of this well-
formed XML file into their individual IDEs. Figure 9 shows the first window of the export
process.
Refactoring
Refactoring is another great way to synchronize code throughout a development process.
Refactoring is a great tool in Zend Studio for Eclipse and is really a glorified search and replace
tool that can be used within a single file or throughout an entire project. For example, if one
version of code has a function called row_color that is globally called row_shade, you can use
the refactor tool to accomplish this. Figure 10 shows the offered results of the refactoring
process.
Code Gallery
The last local development tool that we can look at is called the Code Gallery. This tool is not
directly involved in team development processes, but it can certainly help with the creation of
a repository of code libraries that your development team can use. Once a segment of code (a
function or a class for example) has been written and tested it can be included into the local
code gallery for team use and access. As well the code gallery can be expanded to a server
level location for access from anyone who has the right credentials. The advantage here is that
good tested code can be used across projects as well as across developers in the same project.
Another great feature of the code gallery idea is that Zend has a code gallery of its own that
you can access at any time and you can also submit your own code for possible inclusion into
the global gallery. Figure 11 shows the code gallery creation screen and its controlling view in
the background.
Task Lists
The last Zend Studio for Eclipse view that should be mentioned in the context of team
development is that of the task list manager. Although this is not necessarily directly
employable by a team it can be used very effectively for individual programmers within a team
to manage their own list of things to do. The tasks list view is part of the general PHP
development perspective and should be noticed on almost any basic perspective. It can be
employed to keep track of any reminder items that the programmer wants to track. The tasks
can be tied into a code file or just kept as a general item to be done. If it is tied into a code file
then all the developer has to do to bring it into focus is to double-click on the task and the code
editor will automatically open the connected file.
Corporate Headquarters: Zend Technologies, Inc. 19200 Stevens Creek Blvd. Cupertino, CA 95014, USA · Tel 1-888-PHP-ZEND, 1-888-747-9363 · Fax 1-408-253-8801
Central Europe: (Germany, Austria, Switzerland) Zend Technologies GmbH Bayerstrasse 83, 80335 Munich, Germany · Tel +49-89-516199-0 · Fax +49-89-516199-20
International: Zend Technologies Ltd. 12 Abba Hillel Street, Ramat Gan, Israel 52506 · Tel 972-3-753-9500 · Fax 972-3-753-9501
France: Zend Technologies SARL, 5 Rue de Rome, ZAC de Nanteuil, 93110 Rosny-sous-Bois, France · Tel +33 1 4855 0200 · Fax +33 1 4812 3132
UK: Zend Technologies, 9 Burroughs Gardens, Hendon, London NW4 4AU, United Kingdom · Tel +44 20 8359 1215 · Fax +44 20 8203 6456
Italy: Zend Technologies, Largo Richini 6, 20122 Milano, Italy · Tel +39 02 5821 5832 · Fax +39 02 5821 5400
0000-0108-R2-EN