What is Design Pattern

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:-
[php]
Mage::getSingleton(‘catalog/session’);
[/php]
(iii) Factory Pattern:-The Factory Method is used to instantiate classes in Magento.
Example:-
[php]
Mage::getModel(‘catalog/product’);
[/php]
(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:-
[php]
Mage::register($key, $value);
[/php]
It is used for storing value.
Example:-
[php]
Mage::registery($key);
[/php]
It is used for getting the store value.
Example:-
[php]
Mage::unregister($key);
[/php]
It is used for unregister the variable which is in the registry.