Questions tagged [design-patterns]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
14
votes
1answer
5k views

How many design patterns does Magento Have?

How many design patterns does Magento 2 have?
24
votes
1answer
756 views

Are collections history in Magento 2?

I know that a lot of code that is currently in Magento 2 (2.1.2) is more or less ported from Magento 1 and that a lot of code will be substituted by an equivalent in the future. In this aspect, I'm ...
1
vote
1answer
438 views

In Magento model do we have business logic or a controller?

I have read so many documentation about MVC. But I am still confused regarding the business logic in Magento. Can you please help me to explain business login in Magento with an example ?
-1
votes
1answer
3k views

What is the difference between Mage::getSingleton() and Mage::getModel() in Magento [duplicate]

Mage::getSingleton() always finds for an existing object if not then create that a new object but Mage::getModel() always creates a new object.
1
vote
1answer
615 views

Where to place constants and/or module specific configuration

I have a module that needs smtp authentication information (host, email, method, password, port). I don't want to just hard code this. Where can I put this information where it will have some ...
2
votes
1answer
86 views

Magento2 - Which namespaces to be used inside a class

This might be a novice question, but as when a developer starts to learn Magento2,how do i figure out which all namespaces must be used inside a Model,Block,Plugin or matter of fact any custom class ...
9
votes
1answer
526 views

Magento 2: Creating Data Objects with Immutable State?

Dovetailing off a comment in another Magento 2 If you need to share some calculated value, put the calculation behavior to separate object and call it from blocks that require that value. Registry ...
15
votes
2answers
2k views

Magento2 factory pattern advantages over Magento 1

Magento 2 is using factory classes for non-injectables. For example product class: ProductFactory For example customer class: CustomerFactory I don’t understand what is the type of factory pattern ...