A design pattern is a software engineering part. Magento uses many types of design patterns.
(i) MVC Pattern:- MVC stand for Model View Controller.
Model:- is used for database logic.
View:- is used for presentation logic.
Controller:- is used for routing.
(ii) Front Controller Pattern:- It has a single entry point (index.php) for all of it’s requests.
(iii) Singleton Pattern:-It can be only one instance of a given class. It checks instance is already created or not if created then use this otherwise create a new instance.
Example:-
<pre><code class=”language-php”>
Mage::getSingleton(‘catalog/session’);
</code></pre>
(iii) Factory Pattern:-The Factory Method is used to instantiate classes in Magento.
Example:-
Mage::getModel('catalog/product');
(iv) Registry Pattern:-It is used for transferring data between scopes when they cannot be passed on. It is a global scoped container for storing data. All the singletons are stored in the internal registry.
Example:-
Mage::register($key, $value);
It is used for storing value.
Example:-
Mage::registery($key);
It is used for getting the store value.
Example:-
Mage::unregister($key);
It is used for unregister the variable which is in the registry.