Matthew Weier O’Phinney announced Zend’s naming scheme for the Zend Framework from the point where PHP 5.3 namespaces are used. The issue is, that the PHP parser does not allow class Abstract, neither interface Interface as both “abstract” and “interface” are reserved keywords. So Zend suggests prefixing interfaces with “I” and abstract classes with “A”. Hungarian notation for classes and interfaces.
One of the bullet points in the list of “what makes a name a good name?” is and will be forever “as short as possible, as verbose as needed”, other points are “you must understand the name without studying specific rules before”. The last is why hungarian notation sucks so tremendously. The IFoo/ABar violates two of those criteria: first it is not as verbose as it could be with just a few keystrokes more: AbstractBar would work fine and is much clearer. At second it introduces a special notation you have to grasp before. While AbstractBar would be as descripive as possible, ABar is cryptic for those who are not lucky enough to practice Python programming.
If we are at it, the scheme makes it impossible to have grammatically correct names: IFoo would be read as InterfaceFoo which really should be FooInterface. And no, the fix is not FooI.
Filed on 30-06-2008, 17:05 under PHP, Zend, Zend Framework & ten comments & one trackback

You were a bit bored lately: you wanted to have time and infrastructure for unit tests and continuous integration but it was “too expensive”, you wanted a more grown up, professional structure for development, a coding style, a build system, lots of books for training, augmentative thinking about architecture and object orientation or – more general – work you can both take pride in and sleep well with. This is how we want to develop software (and we are close to it and continuously improving). We are offering two positions: senior developer and another one more suited for career starters.
You will work on various projects, including a not yet released open source framework based on the Zend Framework (and yes, we are using PHP 5.3 for development). You should be fluent in PHP 5, at least know what unit tests are and you have a good understanding of object oriented programming. And no, you don’t need to know who’s invented the pepper mill or the handcar or PHP.
Additionally benefits include table football, a Wii, free water and coffee and silent workplaces.
So the ball’s in your court: if you are interested, drop me a message.
Filed on 04-06-2008, 16:04 under Media Ventures GmbH, PHP, Zend Framework & no comments & no trackbacks
Community websites often notify users about events taking place on a website. These notification, may it classically be an email or may it try a cooler approach like instant messaging, can be good or bad. Most of the time they are really inconvenient. The following list provides a few ideas how to do it better.
First of all, let me decide which notifications I get. This will make me feel better and making me – the user – feel better is always a good thing. It is sad that not everyone is doing it. And yes, per default every notification – maybe except the notification about new messages – is disabled.
This implicitly
I hate HTML emails. I really hate them. They are seldom rendered correctly and hide the information I want to know in an unnecessary layout. Emails are just text and that’s fine. But I know people who really prefers this colorful stuff. Some people just weight a well formatted mail higher. So give them HTML. And text for me. The email standard provides us a way to do this: multipart. My mail client will render text, for others it will render HTML. We are both happy.
There are also libraries encapsulating the multipart standard. Zend_Mail from the Zend Framework is one of those, ezMail from ezComponents is another option.
By the way: there is no need to keep the mail template twice, one for text and one for Email. Use reStructuredText or Markdown to do both in one go.
When I click a link in the notification email I do not want to get a 403. I want to be logged in seamlessly. I know this is a trade-off between convenience and security but generating a secure token for each sent notification is not that hard. When I open my messagebox, let me just click the link host.com/messages/abcdefg123456 and my mailbox appears and I’m logged in. Technically that’s not hard to do, one authentication token per mail with an TTL of a week or so. This applies for Instant Messaging too.
It’s alright if you send me a mail if I’m not logged in for two weeks (unless I don’t disable it) or if you offer me cheaper deals for your payed account (unless I don’t disable it …). But please, do not try to track if I read the mail or what link I have clicked or whatever you might want to know. My inbox is private and when the mail is in my inbox, you are no longer allowed to do anything with it.
The data you get from this kind of tracking will be flawed and wrong anyway – see the chapter about formats and my preference for text above. Also a number of widely spreaded webmail clients like Google mail will not render your tracking pixels anyway, so stop doing that.
And no, it is not cool the use the XHTML extension of Jabber to load tracking pixels (alright, me, being a geek would find it sort of cool).
If you provide a free service for me and do advertising, even context sensitive advertising, it might be a fair deal for me. But this does not apply to messages you send to me. Again: my mailbox is my mailbox, so it is an act of grace to allow you to send me emails. A lot of people more important than you are not allowed to do that, so feel honored. It is just an act of courtesy to not include advertising material from you or your partners in a notification.
I would really love to see the mails you have sent me and what the status is. If your system tells me the notification mail for XYZ has been delayed, because the receiving SMTP-server does greylisting I want to know that I have to wait a few minutes. You will have that information anyway so why shouldn’t you make the process transparent to me? And no, you are not going to tell me the exact SMTP status, assume I’m not the nerd I am, assume I am a customer who wants to know what’s going on. It’s not that hard to translate an SMTP status code into a human readable (and understandable) message which can be displayed to the user.
Filed on 08-04-2008, 21:09 under Best practice, ezComponents, Instant Messaging, Notification, PHP, Webdevelopment, Zend Framework & three comments & no trackbacks
Recently I discussed Zend Framework’s XHR integration. As a result of my research I’ve filed a bug to let Dojo send the X-Requested-With-header per default. A patch has landed in Dojo and will be part of the 1.1 release.
Filed on 25-03-2008, 00:12 under AJAX, Dojo, JavaScript, PHP, Zend Framework & one comment & no trackbacks
The Zend Framework provides a neat function in its request object called isXmlHttpRequest(). The following is therefore possible:
public function someAction()
{
if ($this->getRequest()->isXmlHttpRequest()) {
// AJAX request specific parts
}
}
Zend_Controller_Request_Http::isXmlHttpRequest() checks internally if the request header X-Requested-With is set to “XMLHttpRequest”. If this condition is fullfilled, the request is considered an XH request. However, Prototype, jQuery and YUI set this request in their XHR abstractions, Dojo does not. The following snippet helps to set this in Dojo:
dojo.xhrGet({
url: <url>,
load: <callback>,
headers: {"X-Requested-With": "XMLHttpRequest"}
});
This stucks the X-Requested-With header into the XMLHttp-request and isXmlHttpRequest() will return bool(true).
Interesting to see that Rails is a bit more generous in what it accepts as an XHR. As this header is a pseudo standard it would be worth doing it exactly the same way as Rails does it. Nothing is worse than a pseudo standard with slightly different implementations.
def xml_http_request?
!(@env['HTTP_X_REQUESTED_WITH'] !~ /XMLHttpRequest/i)
end
The RequestHandlerComponent from CakePHP provides a method isAjax() in the stricter Zend Framework variant. Django, Pylons and TurboGears seem not to provide such helpers.
Filed on 08-02-2008, 18:06 under AJAX, Django, PHP, Pylons, Ruby On Rails, TurboGears, Zend Framework & four comments & no trackbacks
Christmas this year meant productivity time for me.
Update: The patch for Liferea is now included in the subversion tree. I’m still working on WebKit for Liferea to complete the missing features.
Filed on 28-12-2007, 23:11 under Christmas, Epiphany, Firefox, GNOME, Liferea, PHP, WebKit, Zend Framework & three comments & no trackbacks
We have added a feature I call naive type detection/casting to Zend Framework’s Zend_Config. Per default Zend_Config is not aware of types, everything is a string (except the crappy auto-detection parse_ini_file() does, but that’s another – ugly – chapter). Our patch provides an opt-in feature to detect wheither something is an integer, a string, a float or a boolean. It does that when a value is fetched, which should be the fastest way (most of configuration values are fetched one time, during a page load). The related ticket is #2312 and the latest patch is available here.
Filed on 17-12-2007, 08:08 under Development, PHP, Zend Framework & one comment & no trackbacks
Tobias Schlitt on »Doing Magic with PHP«. A great overview but I do not agree with the property part of it.
(I found this __set(), __get()-magic pretty unintuitive and unreadable. If I want to learn the API of a Zend Framework class, I just read the source, if I need to learn the API of an ezComponent, I’m forced to read the documentation, which is in fact pretty good. I prefer setters and getters over virtual properties.)
Filed on 10-06-2007, 13:01 under ezComponents, Fluent interfaces, PHP, SPL, Zend Framework & no comments & no trackbacks
John Herren mentioned PhpWishList on Zend Developer Zone. Yippieh!
Filed on 15-01-2007, 00:12 under PHP, PhpWishList, Technology, Zend Framework & no comments & no trackbacks
To adduce my own release README:
»An online-wishlist is a daily tool nowadays. It is used to track and publish wishes to relatives, friends and weblog readers. The usual variant is Amazon’s wishlist implementation. There are a few reasons why to prefer an independent solution to fullfill this need: On the one hand Amazon lacks a lot of products which are offered elsewhere and there is no need to organize such a thing centrally. And, not to forget, there is no newsfeed at all on amazon.com.«You can checkout PhpWishList via SVN. Please consider this at least as a pre-release. There are some glitches, lot of comments are missing in the source files but enjoy what’s there. For installation support consult the README or ask here or via jabber or mail. There is no license listed in any of my source files. If I find time, I will add the link and relevant text to mark it as GPL-software (of course!).
Filed on 02-01-2007, 07:07 under Amazon, PHP, PhpWishList, Technology, Zend Framework & two comments & no trackbacks