As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened,
visit the help center for guidance.
Closed 7 years ago.
I am preparing talk about general architecture of Zend Framework
, and wanted to summarize Design Patterns used in it.
I believe it will be beneficial both for those knowing ZF
and learning DP
s, and for those knowing DP
s and learning ZF
. In a former case, one would be able to see real-world application of patterns, and get a better comprehension of framework in the second.
Even brief answers in a form Zend_Contoller_Front: Singleton
are good enough, if a little elaboration is provided (for some not-so-obvious cases) it will be even better.
I am primary interested in GoF
patterns, as they seem to be the starting point of any DP-adventure.
UPD: Not directly related, but for those who know Java
there's extremely complete answer for GoF
's DP
examples found in Java
core.
Since this is a CW now, I'll add the patterns I already gave in the comments:
Zend_Controller_Front
Singleton
FrontController
Zend_Db_Table
Zend_Log
Factory Method
Adapter
Composite
Zend_Form
Zend_Filter
and Zend_Validator
To name some patterns:
- Front Controller pattern in
Zend_Controller_Front
(index.php + .htaccess)
- Registry pattern in
Zend_Registry
- Dependency Injection in
Zend_Application_Bootstrap_Bootstrap
's container
- Singleton (in
grep getInstance
)
- Strategy patters in
Zend_Form
's validators
- Decorator patterns in
Zend_Form
's decorators
- Adapter pattern in
| grep adapter
File and method names are obvious, so grep
is your friend.
Any volunteer to edit and provide the links and sample code?
To provide a sample of what I want, and to help those who suspect I am asking others to do my leg-work evaluate better whether answers to this question might be helpful to someone else (either trying to learn DPs or ZF), here is sample:
Factory Method Pattern:
- there are many cases where so called Simple Factory is used, and there's not a single place where full-fledged Factory Method Pattern is implemented (as described by GoF).
- Examples of Simple Factory include Zend_Cache, Zend_Db, Zend_Log
For completeness, one should note that Zend_Form uses a modified decorator pattern. In Zend_Form, the generated content is decorated and not the object itself.
Source: http://devzone.zend.com/1240/decorators-with-zend_form/