Added by Mickael PERRAUD, last edited by Mickael PERRAUD on Mar 20, 2008  (view change)

Labels

 
(None)

Zend Framework: Zend_Factory_Abstract Component Proposal

Proposed Component Name Zend_Factory_Abstract
Developer Notes http://framework.zend.com/wiki/display/ZFDEV/Zend_Factory_Abstract
Proposers Mickael PERRAUD
Revision 0.1 - 17 March 2008: Initial proposal creation.
0.2 - 20 March 2008: Corrections and comments. (wiki revision: 8)

Table of Contents

1. Overview

Zend_Factory_Abstract helps to create components by centralizing the code of creation which can apply to several components

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • This component must not break backward compatibility
  • This component will create new element

4. Dependencies on Other Framework Components

  • Zend_Exception
  • Zend_Loader

5. Theory of Operation

When I began to write the code proposed in Zend_Image_Barcode, I looked Zend_Db and Zend_Form:

  • Zend_Db for factory() method
  • Zend_Form for __construct(), setOptions() and setConfig() methods.

And I saw that I entirely copied the code of Zend_Db factory() method with just strings changements.
So I propose to extract this code into Zend_Factory_Abstract and that the Zend_Db class and other components extend Zend_Factory_Abstract.

This proposal is just an extraction of the code of factory method of Zend_Db to be able to use for other components.

6. Milestones / Tasks

  • Milestone 1: design notes will be published here
  • Milestone 2: Working prototype checked into the incubator supporting use cases #1, #2, ...
  • Milestone 3: Working prototype checked into the incubator supporting use cases #3 and #4.
  • Milestone 4: Unit tests exist, work, and are checked into SVN.
  • Milestone 5: Initial documentation exists.

7. Class Index

  • Zend_Factory

8. Use Cases

9. Class Skeletons

This seems to me like another proposal to solve the inversion of control problem. Did you took a look at Zend_Di?

I didn't look Zend_Di before and I'm not familiar with this pattern but I think my proposal approaches this comment.