View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFDEV:Zend Proposal Zone Template}

{zone-data:component-name}
Zend_CommonInterface
{zone-data}

{zone-data:proposer-list}
[~ralph]
{zone-data}

{zone-data:revision}
1.1 - 8 November 2006: Updated from community comments.
{zone-data}

{zone-data:overview}

Zend_CommonInterface is a domain that will server to host common interfaces that framework components can
implement to insure proper coupling without using simply convention or guesswork.

{zone-data}

{zone-data:references}
* [Interfaces|http://us3.php.net/interfaces]
* [Countable|http://www.php.net/~helly/php/ext/spl/interfaceCountable.html#_details]
{zone-data}

{zone-data:requirements}

This domain allows compontents to implement common intefaces to ensure that when optional coupling of components is a nessessity, that certain method expectations can be met.

Consider the following example: Zend_Auth needs to be able to use a persistent storage module for keeping identity stored accross multiple requests. One option for the web arena is Zend_Session. But, perhaps the developer wants to implenent this in a file, or in the registry for a desktop app or somethign similar. Or, the devloper wants to use some kind of central server and home grown cookie implementation ot handle his persistent storage needs. In this case, Zend_Auth would need to use some kind module that implements a common interface.. In this particular example, the common interface would be a "Container" or a "Persistent Storage Container".

As we start drilling down into more specific components as they relate to the MVC paridigm, common interfaces are going become more important if we want to keep the level of coupling between modules low.

{zone-data}

{zone-data:dependencies}
* none
{zone-data}

{zone-data:operation}
They are only interfaces
{zone-data}

{zone-data:milestones}
* Milestone 1: [design notes will be published here|http://framework.zend.com/wiki/x/sg]
* Milestone 2: ?
* Milestone 3: ?

{zone-data}

{zone-data:class-list}
* Zend_CommonInterface_Container
{zone-data}

{zone-data:use-cases}
||UC-01||
{code}
class Zend_Session implements Zend_CommonInterface_Container { ... }

Zend_Auth_Session extends Zend_Session { ... }


// by default Zend_Auth would use Zend_Auth_Session, but to illustrate:
Zend_Auth::setStorageModule(new Zend_Auth_Session());

// in Zend_Auth
...
public static function setStorageContainer(Zend_CommonInterface_Container) { ... }
...


// now the developer can optionally use another module for storage, perhaps My_HashObject which implements Zend_CommonInterface_Container
Zend_Auth::setStorageModule(new My_HashObject(...));

{code}

{zone-data}

{zone-data:skeletons}
{code}
interface Zend_CommonInterface_Container
{
public function __get($name);
public function __set($name, $value);
public function __isset($name);
public function __unset($name);
}

{code}
{zone-data}

{zone-template-instance}]]></ac:plain-text-body></ac:macro>