Magento Design Patterns

Posted by JonB on Stack Overflow See other posts from Stack Overflow or by JonB
Published on 2011-02-18T12:50:27Z Indexed on 2011/02/18 23:25 UTC
Read the original article Hit count: 233

Magento, IMHO, represents a PHP system that is built on well thought-out coding principles - reuseable design patterns being one of them. In terms of an example of a PHP system, I think it can be considered pretty cutting edge and therefore worth considering from an architectural point of view.

As I understand it, there are many design patterns that are available to the OOP developer. Seeing such patterns being put to use in an open-source system such as Magento allows a developer to view examples of such patterns in real use and in situ, rather than in examples that can sometimes be rather achedemic, and even a little misleading.

As such, I am wondering what patterns, other than the ones I have listed below, Magento programmers have used when developing for Magento.

As a note, I understand that some of these patterns are in place as a consequence of being built on the Zend Framework, MVC / Front Controller being a couple of them,

The obvious ones are:

Factory:

$product = Mage::getModel('catalog/product');

Singleton:

$category = Mage::getSingleton('catalog/session');

Registry:

$currentCategory = Mage::registry('current_category');

© Stack Overflow or respective owner

Related posts about php

Related posts about design-patterns