Monday, November 10. 2008
State of annotations in the PHP world
Annotations are a really helpful feature in present-day development. An annotation is a special form of syntactic metadata that can be added to source code elements such as classes, methods, properties and parameters. They do not affect the program semantic directly, but can be used by tools and libraries to handle such annotated code in a certain way. Examples for such usage are marking classes or methods as accessible via web services, marking methods as unit test methods, or to define how an object should be persisted.
Annotations are mainly known from the Java programming language, and since Java 5.0 annotations are a language feature. More important, these annotations are accessible at runtime, which allow various new meta-programming approaches where the domain object stays very clean and does not have any references to the handling code, i.e. when persisting domain objects or rendering them into XML. Today I want to take a look on the state of annotations in the PHP world. PHP itself does not offer such a feature, so we have to take a look at userland implementations. Such implementations are possible using the reflection API introduced with PHP 5. When looking at userland implementations one has to differentiate between specialised and generic implementations. Continue reading "State of annotations in the PHP world" ![]() Monday, November 3. 2008
Stubbles 0.11.0 released
Today we shipped Stubbles 0.11.0, one month later than originally planned and hurting our monthly release cycle. This is mostly due to vacation and time constraints. Unfortunately we have to delay the 0.12.0 and 1.0.0 releases as well, but this fits better into our current time schedule.
But as consolation 0.11.0 brings some really cool new features beside the usual bugfixes. One improvement is within the rss package, which now allows to annotate any entity with the newly introduced @RSSFeed annotation. This makes it much easier to create an rss feed from any object you have in your application. The streams package experienced some improvements like the new memory stream wrapper and better checks for handles so that resources which are not of type stream will now be rejected. Richard contributed an implementation of the FirePHP protocol which allows kind of var_dump() debugging in AJAX applications without breaking the functionality of the application itself when the value is dumped. However the coolest new feature from my point of view is the new support for handling dates. We introduced a new net::stubbles::lang::types::stubDate class, which eases handling of dates. This would not be worth that much of enthusiasm for itself, but the coolest thing about this is that we added filters for transforming request input values into date instances, and moreover our persistance API supports date instances as return values from entities, persisting those into the database and returning them back from there into the entity. This way the developer only has to work with date instances as input and output values, and Stubbles takes care to provide the instances and to persist or serialize them. As always, for a full list of changes see the changelog. Have fun! ![]() Monday, November 3. 2008
Website cache explained
Today I gave a short talk about Stubbles' website cache in our weekly team meeting. The talk explains what the website cache is good for, how it basically works, and what a developer should take into account when developing new page elements. You can find the slides of the talk in the manual for the website cache, see attachments.
![]() Sunday, August 31. 2008
Stubbles 0.10.0 released
Continuing our end-of-month release plan we released Stubbles 0.10.0 today. The release contains fixes and improvements regarding dealing with UTF-8: the string length validators now correctly work with UTF-8 strings, and console streams now deal with input-/output conversion from environment charset to internal charset.
As we are at streams, the streams package experienced an update with two new classes and a new interface: net::stubbles::streams::stubMemoryInputStream and net::stubbles::streams::stubMemoryOutputStream allows to deal with memory streams, and net::stubbles::streams::stubSeekable allows to mark streams as seekable. Both net::stubbles::streams::stubMemoryInputStream and net::stubbles::streams::stubFileInputStream implement this interface. Another new interface is net::stubbles::peer::stubURLContainer which allows better unit testing of classes having net::stubbles::peer::stubURL or net::stubbles::peer::http::stubHTTPURL as typehints on methods. An API breakage was made to the net::stubbles::console::stubExecutor interface and its net::stubbles::console::stubConsoleExecutor implementation. The executor now accepts a net::stubbles::streams::stubOutputStream to stream the output of the executed command to instead of returning the output of the executed script from its execute() method. This breakage allowed us to make the API more fluent and allow better method chaining. Grab the release from our downloads page. ![]() Wednesday, August 6. 2008
Speed, speed, speed!
As requested I did my homework today and tested Stubbles against PHP 5.3 alpha1. Well, actually alpha2-dev, but that should not make that much difference. I don't know whether 5.3 is PHP on drugs, but runtime of our unit tests dropped from around 45 seconds with 5.2.5 to around 15 seconds on 5.3. Down to one third! This is really impressive. We will have to see how 5.3 will perform with the applications itself, but this raises expectations.
The other good news is that we only had two forward compatibility issues, which I instantly fixed. One of them was in a unit test and not relevant to the framework itself, the other had to do with a new check on callbacks which now forbids using private methods in callbacks, even if the callback is triggered from inside the same class. Update At first I thought of just another check for the callback thing, but the comments lead me to reinspect the code. I now think it might really be a bug in PHP 5.3, therefore I created a small script to reproduce the effect, see repository. I sent it it to Lars, who will make sure it gets fixed in the final release. ![]() Wednesday, August 6. 2008
Developer pages and mailing lists
Today I managed to put together some informations for Stubbles developers. These informations contain informations on how to access our repository and how to get commit access, information on our mailing lists, and our coding guidelines. Please take a look at our developer pages. If you have any suggestions for improvements of the contents or about which other informations to add feel free to leave a comment on this entry or to write a mail to our developer mailing list.
Yeah, mailing list. Today we created two real mailing lists: the developer mailing list for discussions about Stubbles and its development, and a commit mailing list. For more informations on how to subscribe see our mailing list info page. A big thanks to Alex Kiesel for helping us to set up both mailing lists and the XP development team for hosting the mailing list technology. Due to the fact that the user community of Stubbles currently is not that big we decided that any user related discussions should take place on the developer mailing list. If one day for any reason the volume of user-related questions gets bigger we may create a separate mailing list then. ![]() Monday, August 4. 2008
Stubbles 0.9.0 released
One month over, time for a new version. As always we aim to release a new version at the end of a month, this time it took a couple of days more due to being busy with other things. However, today we shipped Stubbles 0.9.0 as our second version in beta status, containing a bunch of fixes and minor improvements. We made quite some steps forward to handling all string as UTF-8 internally, but we are still not finished with this yet as there are still some places where we have to put our hands on. I'm quite sure we will have this issues addressed with the next release.
Improvements with this release are the introduction of being able to overrule annotated filters, support for HTTP caching, XSL callbacks for formatting dates and timestamps (unfortunately not complete, the current implementation lacks support for dynamic values from the document tree) amongst other minor improvements. For the complete list see the changelog. You can get the latest version from our download page. ![]() Sunday, June 29. 2008
Stubbles 0.8.0 released
Stubbles 0.8.0 arrived today and brings a bunch of improvements to the existing functionality, most notably for the XML/XSL view engine: bug fixes, enhanced xsl templates, new multi-project structure, support for a common path for styles, images and Javascript used in several projects as well as the stage assistant which displays useful information when in dev or stage mode. Another important point is a reworked package structure, and the release of several star files as an alternative of having one big file. See ticket #139 for more details.
Furthermore we implemented an LDAP access API (no writes yet - we did not need them With this release we raise the level from alpha to beta. All of our originally desired features are implemented and nearly all already proved their use in our applications. However we can not recommend a production use at the moment as the XML/XSL view engine still has to prove itself in our applications, and a lot of documentation is still missing, incomplete or outdated due to changes. This is what we will work on before the next major/minor release. Grab the release from our downloads page. ![]() Sunday, April 6. 2008
Stubbles 0.7.0 released
A few moments ago I released version 0.7.0 of Stubbles. While still being an alpha version, this is most likely the last alpha version before we are going beta. The release was mainly targeted on improving the XML/XSL view engine, and we made quite some steps: we do not need any post interceptor any more when using the XML processor, the complete skin can now be cached as well as that the website cache can be applied onto the generated result. Other noteworthy points are an improved performance of the XML serializer when it comes to an large array of objects of the same instance as well as the replacement of the session resource manager by a new scope within the inversion of control package. Additionally the net::stubbles::util::net package was renamed to net::stubbles::peer as it has not that much to do with utilities itself and there are some plans for more subpackages.
For all changes see the changelog, and download the release from our download page. ![]() Tuesday, March 11. 2008
Searching for a new job?
Ìn case you are interested in a new job and speak german: Read on after the break.
Continue reading "Searching for a new job?"
![]() Wednesday, February 27. 2008
Stubbles 0.6.0 released
This morning I released version 0.6.0 of Stubbles. Main improvement is a new filter API that allows better and simpler creation of filters to retrieve values from the request - and in most usage scenarios one does not have to care about request value error factories any more. See creating filters on how to use the new API.
An important point for those who use the JSON-RPC processor: configuration of services via config/xml/json-rpc-service.xml is no longer supported, you need to migrate to config/json-rpc-service.ini, where the key marks the javascript classname and the value the full qualified classname of the class that contains the web methods. Another point to note is that Stubbles no longer supports dots as package separator. We switched to Paamayim Nekudotayim already with release 0.5.0 but kept support until now to ease adoption. With this change we should have it simpler migrating to namespaces and PHP 5.3 once it is available. As always, for a complete list of changes see our changelog. ![]() Monday, February 18. 2008
Traits for PHP
Just stumbled over a proposal for traits in PHP, proposed by Stefan Marr. Being a bit sceptical at first I came to the conclusion that this would be a really useful feature - and save us a bunch of doubled code in Stubbles. After reading the RFC until the end I noticed that I saw a similar concept some weeks before in Java: Qi4J tries to achieve the same, but requires very much code to get this done. As a language construct within PHP it would be very easy to do the same, but easier to learn and to use. Beside some keyword issues (the RFC uses "use" as keyword, but this will of course conflict with namespaces) I'm wondering what this will have an impact on reflection - the RFC stays unclear about this. What do I get when reflecting a method from a trait, or a method in a class that originally comes out of a trait?
However I'm not very confident that this feature will make its way into PHP - maybe I've read to much internals... ![]() Thursday, January 31. 2008
Stubbles 0.5.0 released
A last day of a month - time to release a new Stubbles version. The release does not feature that much new features, we focused mainly on infrastructure and code quality improvements. The most important change of course is the change of the package separator. Instead of dots we now use Paamayim Nekudotayim, the double colon, which will be the package separator in PHP5.3 with namespaces. The change will ease our transformation towards namespaces. The dot is still supported, but this support will be removed in 0.6.0.
Code quality improvements come from using CodeSniffer for checking adherence to our coding guidelines which allowed us to reduce violences to zero in the main code. The unit tests are currently not checked, but we will take care of this in the future. Another improvement is the switch from SimpleTest to PHPUnit as underlying unit test framework for our unit and integration tests. This allows us to get a code coverage for our tests (which is btw. more than 75%) as well as to calculate some metrics about code quality. It should be clearly stated that SimpleTest is neither a bad unit test framework nor that it would not be suited for a project like this. It has its advantages, but due to various reasons we need the figures about the code and it is currently not foreseeable when something like this will be available in SimpleTest. For a complete list of changes see the changelog. ![]() Saturday, January 26. 2008
Do not trust the reflection API
At least if it comes to internal classes. If you try to get informations about parameters from methods of internal classes - forget that. Examining several internal classes my key findings are: either there is no information about parameters available and the reflection API says the method does not have any parameters, or the information about the parameter is wrong. Some examples I retrieved with the following script:
Continue reading "Do not trust the reflection API" ![]() Wednesday, January 2. 2008
vfsStream 0.3.0 and good bye SimpleTest
Against my intent of starting to work on file modes for 0.3.0 I decided that it is time to get an own repository for vfsStream in order to maintain it independently from Stubbles, which was the perfect reason to open a new project on Google Code. I will see if this proves to be a good solution for day to day development.
The movement also marked the reason to try PHPUnit because I wanted to make use of its code coverage and its software metrics features. Especially the last one showed me a bunch of points that required refactoring before starting something big like supporting file modes. During refactoring some improvements made it into the code which justified a new release: vfsStream now supports rmdir(), and I made some API changes. I dropped vfsStreamDirectory::ceate() in favor of vfsStream::newDirectory() to be equivalent to vfsStream::newFile(). Additionally there is a new vfsStreamContent::at() method now, which allows to write code like this:
$parentDir = vfsStream::newDirectory('newdir')->at(vfsStreamWrapper::getRoot());
$file = vfsStream::newFile('file.txt')->withContent('foo')
->lastModified(time() - 86400)
->at($parentDir);
So far I'm very satisfied with the software analysis features of PHPUnit that I'm thinking very hard about saying good bye to SimpleTest in my other projects. Given the current state of SimpleTest's development I do not expect to get similar features in SimpleTest any time soon, and unfortunately I do not have the time to contribute to SimpleTest even if it would be a lot of fun I guess. ![]() ![]() |
![]() ![]() Calendar
![]() ![]() Categories![]() Quicksearch![]() Blogs we read...![]() Syndicate This Blog![]() Blog Administration![]() ![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||




