Typesafe objects in PHP

It seems that Jan Kneschke again has a nice idea. Well, "revolutionary" at least for PHP. If you know POJO then you might understand POPO without further explanation. In his blog post he talks about the idea of typesafe objects via doc-comments and Reflection. The idea to define proper objects within the doc-comments is nothing new in PHP. But Jan goes some steps further and created serializer classes to map these objects to SQL and XML. This is defenitely something we need to push PHP more into the RAD direction!

2 Comments

  1. Matthew Weier O'Phinney 2007-02-20, 2:19 am

    Gravatar

    Zend Framework is using a similar technique in the Zend_Server-derived classes (WSDL generator, REST server, XML-RPC server so far; more coming in future releases). Basically, we require that the docblock contain @param and @return elements; Zend_Server_Reflection then goes through and scans the class and the method docblocks in order to build up prototypes that the server implementation may use.

    The Reflection API makes this sort of thing possible, and very powerful.

  2. Manfred Weber 2008-05-26, 2:57 pm

    Gravatar

    Matthew, your Zend_Server class looks like a copy of our much earlier created Services_Webservice class available at pear. Except that our class also support Complex Types! but thanks for the hint anyway!

Add a Comment