by Mika Tuupola (tuupola@appelsiini.net), Pierre-Alain Joye (paj@pearfr.org)
Starting this week, we introduce a new "Package of the week" section in the PEAR weekly news. This week focuses on APD from George Schlossnagle, a full-featured profiler/debugger.
It has been a moderately quiet week in the mailinglists. Consequently there has been more CVS traffic and more releases than usual. As a time of writing total number of new PEAR releases this week is 14.
This weeks news include details on error handling in constructors, new phpDocumentor features, another Mac OS X tutorial and seven new proposed packages.
George started working on UNIX systems 12 years ago, writing numerical partial-differential analysis routines in FORTRAN. He started playing with the web 8 years ago and has been doing it professionally for 5 years. He is currently a principal consultant at OmniTI Computer Consulting, a technology consulting firm specializing in building and managing scalable web and email systems.
I think my only regret about publishing apd under PECL is that I didn't do so sooner. From a code/version management standpoint I working in PECL is equivalent to working on a locally manged project. The PEAR release management system makes rolling and pushing a new version incredibly simple. Also I see are increased visibility and interest from the PHP community. Finding out that apd installed cleanly under 4.3 via the PEAR installer (with no effort from me to make it do so), was very cool.
I think PEAR and PECL are the future of php extension and package management. By decoupling PHP versions from extension versions, we can hopefully increase the speed, quality and frequency of PHP releases. I would personally like to see an increase use of unit testing in PEAR and PECL packages (my own packages being incredibly in need of this) Adding unit tests should make refactoring easy and reduce developers hesitation to improve other extensions/packages for fear of unintentionally breaking things. As unit testing in the php build process continues to mature and more extensions are moved into PECL, I hope to see an improvement in cross-version compatibility for many PECL'd extensions.
apd is a zend_extension which adds profiling and debugging abilities to the Zend Engine. apd had humble beginnings. My former colleague Dan Cowgill was very frustrated with the lack of full backtrace capability (this was back in 4.1 days, well before debug_backtrace() was available.) After the backtrace capabilities where added, it became obvious that the engine we developed provided a excellent interface to generate profiling information for scripts.
This profiling ability was incredibly valuable to the work I was doing at that time, which involved performance tuning the production environment for some sites with a million-line code base. Without profiling capabilities tuning scripts was largely a matter of guess work. With the pre-0.1 version of apd running, we were able to get 500% performance gains on a number of pages within a day.
Early after the initial release, Thies Arntzen made a feature request that the profile information not be human readable text, but instead be something similar to what the utility gprof can read. It took a while, but starting with version 0.3 'pprof' output became the standard format, and a utility 'pprofp' was bundled to read the files. This was a big step, as it allowed for easy and robust post-trace processing (displaying call graphs, ordering by a number of different execution time metrics, etc.)
APD has a number of additional features as well. Most notably is the full interactive debugger support that Alan Knowles added. This allows an ide to do a step-by-step execution of a script, and has the ability to not only display variables at every step, but to modify them as well. The only ide I know which supports this fully is Alan's magnificent phpMole, which I would recommend to anyone interested in a php ide.
Some features which are seldom used, but cool nonetheless include the rename_function() and override_function() functions, which allow you to replace an existing function in the symbol table with one of your own creation. It would be nice to see functions similar to these integrated into the Zend Engine. Other features will likely we deprecated over time. The backtrace commands have been supplanted by the debug_backtrace and debug_print_backtrace commands and the symbol table introspection functions are not terribly useful.
One billion dollars... mwahaha!
Seriously though, when I started writing open source software in 1999,
I mistakenly thought that I could create a project and have people
flock to it to add features that I wanted. That is simply not the way
it works. In fact, I (like most open source programmers I know), spend
at least as much time implementing features that other people want as I
do implementing things that I am interested in personally. My goal in
writing apd was primarily to create a tool that helped me in my job,
and next to help others executing similar tasks. If apd helps people
write faster and better code, then this has been a successful project
to me.
I would like to thank the apd user community for:
The Mac OS X tutorial mentioned in a previous issue is now also published in MacDevCenter. Since this site is part of O'Reilly Network PEAR will get nice coverage from this article.
If you come accross PEAR related article article feel free to send (pear-dev@lists.php.net) us the references and they will be added to the weekly news.
There was a short discussion on what is the recommended way of handling errors in constructors. The answer is really simple: Even though it is possible to set $this to be an instance of PEAR_Error it is discouraged to use this undocumented feature. This behaviour will be changed in PHP5. A better aproach is to avoid all failing logic in constructor and use a separate method for calls which need to be able to return an error. A good example of such method would be any factory method.
phpDocumentor development team has implemented support for new tags in their documentation tool. These include such tags as @source, @internal, @filesource, @example and @internal. For more info please see the release notes.
Thanks to these people for spotting and fixing some bugs: Ondrej Jombik, Andres Käver, Patrick O'Lone, Bruno Pedro and Samuli Tuomola
Lorenzo Alberton ported Wolfram Kriesing's DB_QueryTool to work with MDB.
Kubo Atsuhiro proposed his Net_UserAgent_Mobile which can be used to get keitai (mobile phone) display characteristics. Supported systems are NTT DoCoMo's i-mode, KDDI's EZweb and J-PHONE's J-Sky.
Yavor Shahpasov proposed a new container for Auth. This new container enables authentication against POP3 servers.
Michael Bretterklieber, the maintainer of PECL::radius, proposed several authentication related packages. Auth_RADIUS is a wrapper class for PECL::radius. Crypt_CHAP is used for generating CHAP-packets for the different versions of CHAP. Auth_Container_Radius is a new container for Auth package.
Bertrand Mansion proposed his SearchEngine_Mnogosearch package, which is a PHP frontend for the popular mnoGoSearch searchengine.
Active on CVS this week have been: HTML_Template_Flexy, Cache_Lite, PECL::Radius, PEAR, DBA, DBA_Relational, HTTP_Header, MDB, Net_SMTP, Mail, Log, File, I18N, SpreadSheet_Excel_Writer, MDB_QueryTool, Payment_Clieop, PECL::bcompiler, Tree, DB_QueryTool, HTML_Template_Xipe, DB_DataObject, HTML_QuickForm, PECL::imagick, Auth, SearchEngine_Mnogosearch, Net_URL, HTTP_Request and PECL::apd.