Published on developerworks, an excellent article introducing Service Data Objects in PHP.
What is SDO?
SDO is an implementation of the Active Record Design Pattern. SDO is not meant to remplace JDO or an O/R framework. Its at a lower level than JDO or EJB3. JDO, EJB3, Hibernate and others are layer oriented (domain layer), while SDO could be used as a Value Object to communicate between the layers.
The concept is a bit like :
- folding object trees in the NatSTAR Client/Server CASE (fr=AGL)
- using WDDX (Web Dynamic Data Exchange) to send data structure to the client browser and back in Adobes ColdFusion Application server (formerly Macromedia / formerly ColdFusion)
Why use SDO in PHP?
- Backed by ZEND and IBM
- Reduced database overhead
- Single API for data
- Knowledge of the structure
Among the features :
- XPath-ish API to traverse the data
- lazy loading is possible (dunno if IBMs implementation does this)
- disconnected DataSets
SDO has been submited to standardization commitees but its only one of a number of different proposed techniques.
WDDX (which was pushed by ColdFusion) is for instance a norm but, to my humble knowledge, no one uses it except CF programmers.
Service Data Objects (SDOs) have been around in the Java™ technology world since November 2003. They are designed as a means of simplifying and unifying working with heterogeneous data sources. In February 2005, IBM and Zend announced a strategic partnership to collaborate on the development and support of the PHP environment. One aspect of this collaboration has been the definition and implementation of SDOs for PHP. This article gives an overview of SDOs and the motivations for using them in the PHP environment. A simple contact management scenario is used to illustrate key concepts.