The Well-Tempered PHP Developer
Can there be any errors if the testing techniques mentioned above are applied? Unfortunately, there are well-known theorems showing that no amount of testing can ensure program correctness, so now and then, you still will find yourself trying to figure out what went wrong. Classically, PHP programmers use print statements—usually, a die(...) instruction—but that's a cumbersome way of doing it. Furthermore, changing a program in order to see what happens (even if the change is an innocuous printing command) is not a good idea; you can make things even worse accidentally.
Although some languages (notably Java and Smalltalk) always have had quite good debugging environments, allowing you even to trace the code on a sentence-by-sentence basis, setting breakpoints, examining variables and so on, PHP programmers too often have found themselves with the short end of the stick.
There are basically two options: XDebug and DBG. XDebug is up to version 2.0.3 (from April 2008), and it's fully open source. On the other hand, DBG has two versions: a free one (at version 2.15.5) and a commercial one (at version 3.1.11). XDebug supports PHP 5.3, and DBG works only up to 5.2. For both programs though, the main sticking point is configuration, which is far too long to include here (see Resources). After you get the debugger to run, you will be able to debug your code easily; it's a pity that the installation procedure is such a chore.
Version control (also known as revision control or source code control) is a must for large-scale, multi-developer projects, but it also offers significant advantages even for standalone work. The first time you thrash your code and manage to restore it or find what you changed thanks to your VC system, you will fully appreciate version control.
Basically, all VC systems allow you to store documents and record the changes made to them. VC systems allow you to inspect not only the latest version of any document, but also to go back to previous ones and work out the differences between any two versions. Explaining version control in all its details is beyond the scope of this article.
Many different version control programs are available: BitKeeper, Git, Mercurial, CVS and SVN, but not all of them have Eclipse plugins. At the very least, both CVS and SVN can be used with PHPEclipse, but I prefer the latter, because it allows for moving files; CVS doesn't.
PHPEclipse can connect to SVN repositories by using either Subversive or Subclipse. Note that at the time of this writing, both plugins are assured to work only with Eclipse 3.3 (Europa) and not with 3.4 (Ganymede). After installing one of those plugins, you will be able to download a working copy or synchronize your work with the repository, simply by right-clicking on the project and selecting the Team option. The results of a synchronization operation will show in a separate console and usually will consist of files that you should download (others have modified them and you are not up to date), files you should upload (only you have modified them) and conflict files. Clicking on a conflicting file will bring up a file comparison window (Figure 6), highlighting the differences between your code and the already uploaded code. How to merge that code is up to you.
Eclipse can provide a great environment for PHP development, with all the necessary tools for modern, agile development. Take the time to learn all the existing functions, and you will find yourself creating good quality code in a faster, surer and easier way.
PHP Home Page: www.php.net
Eclipse Home Page: www.eclipse.org
Eclipse Download Page: www.eclipse.org/downloads
IBM's Description of Ganymede's New Features: www-128.ibm.com/developerworks/library/os-eclipse-ganymede
The IcedTea Project—a Free Implementation of Java: icedtea.classpath.org
Sun Developer Network Page: java.sun.com
PHPEclipse Latest Version Update: update.phpeclipse.net/update/nightly
PHPEclipse Full Documentation: docs.schuetzengau-freising.de/modules/xdocman/index.php?doc=xo-002
The Last Craft (PHP Testing): www.lastcraft.com
SimpleTest for the Eclipse Update: simpletest.org/eclipse
PHP Debugging: www.ibm.com/developerworks/library/os-debug
Configuring XDebug for PHPEclipse: dev.phpeclipse.com/wiki/XDebug_and_PHPEclipse
DBG Installation Guide: dd.cron.ru/dbg/installation.php
PHPEclipse DGB Configuration: docs.schuetzengau-freising.de/modules/xdocman/manual.php?doc=xo-002&id=sec.install_dbg&file=ch01s05.html
The Subversive Plugin for Using Subversion: www.eclipse.org/subversive
Subclipse, an Alternative for Accessing SVN Repositories: subclipse.tigris.org
Federico Kereki is an Uruguayan Systems Engineer, with more than 20 years' experience teaching at universities, doing development and consulting work, and writing articles and course material. He has been using Linux for many years now, having installed it at several different companies. He is particularly interested in the better security and performance of Linux boxes.
Fast/Flexible Linux OS Recovery
On Demand Now
In this live one-hour webinar, learn how to enhance your existing backup strategies for complete disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible full-system recovery solution for UNIX and Linux systems.
Join Linux Journal's Shawn Powers and David Huffman, President/CEO, Storix, Inc.
Free to Linux Journal readers.Register Now!
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- July 2016 Issue of Linux Journal
- Client-Side Performance
- Tibbo Technology's Tibbo Project System
- Libarchive Security Flaw Discovered
- Sony Settles in Linux Battle
- Peppermint 7 Released
- Profiles and RC Files
- Snappy Moves to New Platforms
- The Giant Zero, Part 0.x
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide