|All reviews||Delphi for PHP 2.0||Latest reviews||Best sellers ranking|
Delphi for PHP 2.0
May 2, 2008
Week: 25 All time: 11
manuellemos.netA new version of Delphi for PHP IDE was released this year. It is a follow-up of Delphi for PHP 1.0 released for the first time in 2007.
Since I have already reviewed the first Delphi for PHP release in 2007, this review will focus only on the changes.
First I would like to make a few clarifications. Delphi for PHP is a great PHP IDE that is well worth trying, but I have seen many comments about it in PHP forums and mailing lists that reflect several misconceptions about the program that seem to come from people that really have not given it a chance. So, I thought it would be useful to start by clarifying what is Delphi for PHP, as well what it isn't.
Delphi for PHP was developed by CodeGear. CodeGear used to be a division of Borland. Early this CodeGear was sold to Embarcadero Technologies, well known for its visual database design tools. This change of parent company from Borland to Embarcadero did not change what Delphi for PHP is.
Delphi for PHP is an IDE (Integrated Development Environment) program in its essence, very similar to other PHP IDE like Zend Studio, NuSphere PHP IDE, Komodo, or even Microsoft Visual Studio with VS.PHP add-on. This means that you can edit, run, debug, profile PHP Web applications from Delphi for PHP like you would from other PHP IDE.
Delphi is also the name of IDE program developed by Borland to create Windows applications. Despite the use of name Delphi, the only common feature between Delphi for Windows and Delphi for PHP is the support for creating user interfaces using a visual editor based on dragging and dropping components.
Besides the visual user interface creation support, everything else is different. Delphi for Windows is for creating Windows application executable programs written in Object Pascal language. Delphi for PHP is for creating Web applications written as PHP scripts. Delphi for PHP was not meant for creating desktop application executables, although that would be possible using separate compiler tools like RoadSend PHP compiler.
Another misconception that I read about Delphi for PHP is the claim that you are required to use the visual user interface editor to create PHP applications, as well that it makes you use "dirty code" generated by the program. This is not true. You can write PHP code with Delphi for PHP without using the visual editor, just like you can edit code with other PHP IDE.
Delphi for PHP provides PHP code highlighting and code completion support just like other PHP-aware editors. If you do not want to benefit from visual editing support, you can.
If you want to use the visual editing support, Delphi for PHP will generate skeletons of classes of PHP objects to configure each of your Web application user interface elements. You can even change or replace the code of those classes if you want. There is nothing "dirty" about the generated classes. They are quite simple, easy to understand, and you can customize them for your needs.
Another complaint is that you are required to use the VCL framework in your PHP applications. VCL (Visual Component Library) is an Open Source framework of PHP classes that provides the necessary features to integrate visual and non-visual components in the visual editor.
You only need to use the VCL framework in your applications if you use the visual editor to define your application pages user interface. If you write PHP code without using the visual editor, you do not need the VCL framework in the production servers where your PHP applications are running.
VCL is provided by CodeGear developers for free as an Open Source project. Despite this fact, you can create PHP applications without having to use the VCL, just like you can create PHP applications with Zend Studio without having to use the Zend Framework.
After these clarifications, lets move on to the new features of Delphi for PHP 2. Talking about Zend Framework, one of the new features is precisely the support to some classes of the Zend Framework. Currently it supports Zend Framework authentication and access control components. It also supports components from other PHP libraries, such as PEAR data grid class.
Supporting these third party libraries seems to be a step in the right direction for Delphi for PHP. The truth is that in PHP there is no dominant framework or class library. Unlike developers that use other languages, PHP developers use a wide range of class libraries, different coding styles, different Web development methodologies. That is part of the reason why PHP is so popular.
This situation makes it hard for developer tool vendors to embrace the community as a whole. To solve this problem, instead of pushing their own VCL components, Delphi for PHP developers decided to embrace other class libraries too, targeting the needs of many more PHP developers.
Now the support to other class libraries needs to be expanded, so more PHP developers find Delphi for PHP more useful to them. But CodeGear does not have to do that. VCL is Open Source and anybody can extend it without depending on CodeGear.
Before moving on to the enhancements made to the IDE itself, let me tell you about an unexpected feature. Actually it is not really a feature of Delphi for PHP 2, but rather something the benefits a kind of audience that was not being targeted by this IDE. Let me explain.
In the past I asked CodeGear people if they planned to provide a version that works on Linux or Mac OS X . They told me it was not viable for them because the market for such platforms is not yet big enough.
I only use Linux for as my desktop, PHP development and production platforms. I was actually considering to develop components to allow visual editing of PHP generated forms with a very popular class that I have been developing since 1999. Although I understand CodeGear people position regarding Linux and Mac OS X, I was frustrated.
The good news is that it is now possible to run Delphi for PHP on those platforms using the latest version of Wine. For those not familiar with Wine, it is a program that loads Windows executable programs. It provides an API that emulates the Windows API under the host environment. Wine is available for Linux, FreeBSD, Mac OS X and Solaris. More information may be obtained in Wine home page:
I tried running Delphi for PHP 2 under OpenSuSE Linux 11.0 using Wine 1.1.1 . It worked wonders. The Wine version available when Delphi for PHP 2007 was released could not run the program.
I did not try it with Wine under Mac OS X, FreeBSD or Solaris because I do not have a machine running on those platforms. It would be interesting if anybody could post comments on whether they could run Delphi for PHP with Wine under any of such operating systems.
With this new possibility to Delphi for PHP 2 under Linux, I am particularly motivated to make some time and develop a new VCL component that allows me to create PHP generated forms using my forms class.
As a side comment, there is a wizard in the Delphi for PHP 2 that makes it easier to create new IDE components from scratch or based on existing components, all using PHP code. So all is much simpler and viable now.
However, Delphi for PHP 2 does not yet run flawlessly under Linux with Wine. Delphi for PHP 2 still makes calls to some Windows API functions that are not yet implemented by Wine or need to be fixed. In practice the IDE runs perfectly but some transparent controls do not render correctly.
Also it was not possible to run a PHP application being developed from the IDE using the Run function. Delphi for PHP 2 comes with pre-configured versions of Apache and PHP for Windows. Apache is used to debug and test PHP applications started from Delphi for PHP 2. Unfortunately Apache relies on Windows socket API functions that do not seem to be working under current Wine versions.
Wine is one of the Open Source projects sponsored by Google Summer of Code. However, I do not know if the features that need to be fixed to run Delphi for PHP 2 properly are being addressed by the Wine sub-projects approved for Google Summer of Code 2008.
My suggestion to CodeGear developers is that they work together with Wine developers to implement the necessary functionality that can make Delphi for PHP 2 run flawlessly under Linux, Mac OS X, FreeBSD and Solaris. That would help CodeGear target a wider market of PHP developers at a fraction of the cost that it would take them to develop Delphi for PHP native versions for those platforms.
Back to the review of the IDE itself, the enhancements since Delphi for PHP 1.0 are numerous. So I will focus only on some that I consider more important and are directly related with PHP.
It is worth mentioning that Delphi for PHP 2 is now available in several other languages besides English, like Chinese, German, Portuguese and Spanish. If any of these is your mother language, you will appreciate this enhancement.
One of the noticeable enhancements of Delphi for PHP 2 is the ability to create HTML templates that are associated to tags like those of ASP or JSP. Then those tags are expanded to more complex HTML defined by templates. This is helpful to decouple PHP code from HTML generated by the components, but developers are free to embed PHP code in HTML templates if they prefer.
Code insight is a set of features that help the developer write error free code in a faster manner. It includes PHP context sensitive code completion. It also provides hints about what each of the suggested code completion alternative function calls or parameters do, so the developer pick the right suggestion for what he intends to do.
Another cool feature is the error insight. The IDE continuously scans the syntax of PHP code that the developer types. Any syntax errors found are displayed in real-time on the structure window pane. Code in error appears underlined like word processing programs denote words with spelling mistakes.
This is one of those basic features that all PHP IDE programs should have but not every PHP IDE provides it. It can save developers a lot of time trying to run code with silly syntax errors.
As in the previous version, Delphi for PHP 2 comes with extensive debugging support. As I mentioned above, it comes with a customized version of Apache and PHP. It uses Nusphere DBG extension to communicate with PHP while single stepping a script being debugged.
One of the enhancements of Delphi for PHP 2 is that it can also profile your script, so you can have a good idea what code it is taking more time to run. Then you can focus your optimization efforts to speedup that code.
All these features are great but there is still room for improvement that should be addressed in future versions.
One thing that I missed in this version is the integration with common version control systems like CVS or SubVersion. Version control systems are mandatory when you work in a team, but even when you work alone they are very useful, so you can keep track of the changes you do on your project files.
It is not a serious deficiency because it could be solved using control version tools separately. Actually that is what I do when using any other IDE. But some people would find version control more pleasant if the IDE would provide integrated support to let you do things like browse and checkout files in the project repository, as well visually present the changes you made before you commit them back to the repository.
Another thing, that would be interesting to have is memory usage profiling. This is something that can be very useful for those running PHP on very busy sites.
There is a great debate on whether PHP and other languages can scale up to enterprise level needs. Scalability is not a matter of language, but rather of application architecture.
However, one details that really matters in busy sites is the cost of scalability. Each simultaneous user access that an application may handle takes a given amount of RAM. If the RAM is exhausted in one server, the application needs more servers to handle the load without slowing down too much.
If one PHP application has scripts that take large amounts of memory, that makes the cost of scalability go up because the application would need more servers. Therefore it is important to monitor and limit the use of memory of PHP scripts.
This may require finding which parts of the scripts are making them take so much memory, so their code can be eventually rewritten to avoid the problem and reducing the memory usage. An IDE with good memory usage profiling support can be very useful to achieve this task. That would be a great feature for future Delphi for PHP 2.
If you want to try Delphi for PHP for free, you can download a free trial version from its Web page:
Overall, Delphi for PHP 2 is great update to first version released last year. If you were already using it version 1, this version is well worth the upgrade.
If you were not using Delphi for PHP because you did not know it before, or because of the misconceptions mentioned in the beginning of this review, you may want to give it a better look, as it provides many features that can significantly enhance your PHP development productivity.
If you were not considering using Delphi for PHP 2 because you were not aware that it can now run on Linux or Mac OS X, now you may want to reconsider, as the latest versions of Wine finally made that possible.
1. PHPClasses.org: Review - Delphi for PHP 2.0 (2008-07-23 12:16)