Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use...
Transcript of Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use...
![Page 1: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/1.jpg)
![Page 2: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/2.jpg)
Key Insights into Development Design Patterns for Magento 2
![Page 3: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/3.jpg)
CTO @ GiftsDirect, TheIrishStore
Max Pronko
![Page 4: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/4.jpg)
Today’s Presentation Includes
• Design Patterns and Magento 2 • Aspect Oriented Programming • Questions and Answers
![Page 5: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/5.jpg)
Design Patterns
![Page 6: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/6.jpg)
What is Design Pattern?
describes a problem which occurs over and over again, and then describes the core of the solution to that problem, without ever doing it the same way twice
“- Christopher Alexander
![Page 7: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/7.jpg)
Composite pattern is used to treat a group of objects in similar way as a single object uniformly
Composite Pattern
![Page 8: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/8.jpg)
Composite Diagram
BuilderInterface
Common
implements
AddressCreditCard Composite
1
*
Magento\Payment\Gateway
![Page 9: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/9.jpg)
BuilderComposite Example
class BuilderComposite implements BuilderInterface { /** @var BuilderInterface[] */ private $builders;
public function __construct($builders) { $this->builders = $builders; }
public function build(array $buildSubject) { $result = []; foreach ($this->builders as $builder) { $result = array_merge_recursive($result, $builder->build($buildSubject)); }
return $result; } }
![Page 10: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/10.jpg)
CompositeBuilder Declaration
<config> <virtualType name="CaptureBuilderComposite" type="Magento\Payment\Gateway\Request\BuilderComposite"> <arguments> <argument name="builders" xsi:type="array"> <item name="common" xsi:type="object">Pronko\Payment\Gateway\CommonBuilder</item> <item name=“credit_card" xsi:type="object">Pronko\Payment\Gateway\CreditCardBuilder</item> <item name="address" xsi:type="object">Pronko\Payment\Gateway\AddressBuilder</item> </argument> </arguments> </virtualType> </config>
File: Pronko\Payment\etc\di.xml
![Page 11: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/11.jpg)
Strategy lets the algorithm vary independently from the clients that use it
Strategy Pattern
![Page 12: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/12.jpg)
Strategy Pattern Diagram
BuilderInterface
CaptureBuilder
implements
PartialBuilder
CaptureStrategy
GatewayCommand
implementscalls
uses
Magento\Payment\Gateway
![Page 13: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/13.jpg)
Strategy Pattern
class CaptureStrategy implements BuilderInterface { /** @var BuilderInterface */ protected $partial; /** @var BuilderInterface */ protected $capture;
public function build(array $buildSubject) { $condition = //set condition
if ($condition) { return $this->partial->build($buildSubject); }
return $this->capture->build($buildSubject); } }
![Page 14: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/14.jpg)
Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses
Factory Method Pattern
![Page 15: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/15.jpg)
Factory Method Pattern Diagram
TransferFactory
implements
TransferFactoryInterfaceGatewayCommanduses
create()
Magento\Payment\Gateway\Command
Transfercreates
![Page 16: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/16.jpg)
Transfer Factory Example
namespace Magento\Braintree\Gateway\Http;
class TransferFactory implements TransferFactoryInterface { private $transferBuilder;
public function __construct(TransferBuilder $transferBuilder) { $this->transferBuilder = $transferBuilder; }
public function create(array $request) { return $this->transferBuilder ->setBody($request) ->build(); } }
![Page 17: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/17.jpg)
Transfer Factory Example
namespace Magento\Braintree\Gateway\Http;
class TransferFactory implements TransferFactoryInterface { private $transferBuilder;
public function __construct(TransferBuilder $transferBuilder) { $this->transferBuilder = $transferBuilder; }
public function create(array $request) { return $this->transferBuilder ->setBody($request) ->build(); } }
class GatewayCommand implements CommandInterface { public function execute(array $commandSubject) { $transferO = $this->transferFactory->create( $this->requestBuilder->build($commandSubject) );
$response = $this->client->placeRequest($transferO) // … code } }
![Page 18: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/18.jpg)
Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically
Observer Pattern
![Page 19: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/19.jpg)
Observer Pattern Diagram
Manager Config
implements
ObserverInterface
ManagerInterfaceAdapterdispatch()
getObservers()
execute()
events.xml
PaymentObserver
implements
Magento\Payment
![Page 20: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/20.jpg)
Dispatching an event
use Magento\Framework\Event\ManagerInterface;
class Adapter implements MethodInterface { /** @var ManagerInterface */ protected $eventManager;
public function assignData(\Magento\Framework\DataObject $data) { $this->eventManager->dispatch( 'payment_method_assign_data_' . $this->getCode(), [ AbstractDataAssignObserver::METHOD_CODE => $this, AbstractDataAssignObserver::MODEL_CODE => $this->getInfoInstance(), AbstractDataAssignObserver::DATA_CODE => $data ] );
return $this; } }
![Page 21: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/21.jpg)
Observer Configuration
<config> <event name=“payment_method_assign_data_custom"> <observer name="custom_gateway_data_assign" instance="Pronko\Payment\Observer\DataAssignObserver" /> </event> </config>
File: Pronko\Payment\etc\events.xml
![Page 22: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/22.jpg)
Observer Implementation
namespace Pronko\Payment\Observer;
use Magento\Framework\Event\Observer; use Magento\Payment\Observer\AbstractDataAssignObserver;
class DataAssignObserver extends AbstractDataAssignObserver { public function execute(Observer $observer) { $data = $this->readDataArgument($observer); $additionalData = $data->getData(PaymentInterface::KEY_ADDITIONAL_DATA); $payment = $observer->getPaymentModel();
$payment->setCcLast4(substr($additionalData->getData('cc_number'), -4)); } }
![Page 23: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/23.jpg)
Typical implementation of Dependency Manager. Enables Inversion of Control support for Magento 2
Object Manager
![Page 24: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/24.jpg)
Object Manager
• Dependency Manager • Instantiates classes • Creates objects • Provides shared objects pool • Supports lazy Initialisation • __construct() method injection
![Page 25: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/25.jpg)
Object Manager Implementation
Singleton
Builder
Abstract Factory
Factory Method
Decorator
Value Object
Composite
Strategy
CQRS
Dependency Injection
…
![Page 26: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/26.jpg)
Object Manager Diagram
ObjectManagerInterface
ObjectManager
App/ObjectManager
ObjectManagerFactory App/Bootstrap
[Object]
uses
creates
configures
uses[Object]
[Object]
Magento\Framework\ObjectManager
![Page 27: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/27.jpg)
Object Manager Usage
Good • Factory • Builder • Proxy • Application • generated classes
Bad • Data Objects • Business Objects • Action Controllers • Mage::getModel like calls • Blocks
![Page 28: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/28.jpg)
Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality
Decorator Pattern
![Page 29: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/29.jpg)
Decorator Pattern Diagram
FactoryInterface
Dynamic\Production
implements
AbstractFactory
Dynamic\Developer
Profiler\FactoryDecorator
1
1
Magento\Framework\ObjectManager
Compiled
extends
![Page 30: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/30.jpg)
namespace Magento\Framework\App\ObjectManager\Environment;
abstract class AbstractEnvironment implements EnvironmentInterface { protected function decorate($arguments){ if (isset($arguments['MAGE_PROFILER']) && $arguments['MAGE_PROFILER'] == 2) { $this->factory = new FactoryDecorator( $this->factory, Log::getInstance() ); } } }
Decorator: Profiler Factory
![Page 31: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/31.jpg)
namespace Magento\Framework\App\ObjectManager\Environment;
abstract class AbstractEnvironment implements EnvironmentInterface { protected function decorate($arguments){ if (isset($arguments['MAGE_PROFILER']) && $arguments['MAGE_PROFILER'] == 2) { $this->factory = new FactoryDecorator( $this->factory, Log::getInstance() ); } } }
Decorator: Profiler Factory
class DecoratorFactory implements FactoryInterface {}
class CompiledFactory implements FactoryInterface {}
![Page 32: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/32.jpg)
A proxy is a class functioning as an interface to something else. It is used for resource consuming objects
Proxy Pattern
![Page 33: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/33.jpg)
Proxy Pattern Diagram
NoninterceptableInterface
AreaList/Proxy
\Magento\Framework\App
AreaList
implements
extends
![Page 34: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/34.jpg)
Proxy Pattern Declaration
<config> <type name="Magento\Framework\Config\Scope"> <arguments> <argument name="areaList" xsi:type="object">Magento\Framework\App\AreaList\Proxy</argument> </arguments> </type> </config>
File: app/etc/di.xml
![Page 35: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/35.jpg)
Aspect Oriented Programming
![Page 36: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/36.jpg)
a programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns. The goal is to achieve loose coupling
Aspect Oriented Programming
![Page 37: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/37.jpg)
AOP Cross Cutting Concerns
Security
LoggingMonitoring
Catalog Sales
Checkout …
![Page 38: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/38.jpg)
Magento AOP Example
Client
PluginPlugin Target
Interceptor
Plugin
Invoke Method
Result
Interception Pipeline
ObjectManager
Result
Invoke
get Result
![Page 39: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/39.jpg)
Types of a Plugin
MethodBefore After
Around
Affects input method argument
Modifies behaviour
Affects method return value
![Page 40: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/40.jpg)
Check Module Status Plugin
After
Around
namespace Magento\Framework\Module\Plugin;
class DbStatusValidator { public function aroundDispatch( \Magento\Framework\App\FrontController $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request ) { if (!$this->cache->load('db_is_up_to_date')) { $errors = $this->dbVersionInfo->getDbVersionErrors(); if ($errors) { // throw exception } else { $this->cache->save('true', 'db_is_up_to_date'); } } return $proceed($request); } }
![Page 41: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/41.jpg)
Invalidate Cache Plugin
After
Around
namespace Magento\WebapiSecurity\Model\Plugin;
class CacheInvalidator { public function afterAfterSave( \Magento\Framework\App\Config\Value $subject, \Magento\Framework\App\Config\Value $result ) { if (\\condition) { $this->cacheTypeList->invalidate(\Magento\Webapi\Model\Cache\Type\Webapi::TYPE_IDENTIFIER); }
return $result; } }
![Page 42: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/42.jpg)
Password Security Check Plugin
After
Around
namespace Magento\Security\Model\Plugin;
class AccountManagement { public function beforeInitiatePasswordReset( AccountManagementOriginal $accountManagement, $email, $template, $websiteId = null ) { $this->securityManager->performSecurityCheck( PasswordResetRequestEvent::CUSTOMER_PASSWORD_RESET_REQUEST, $email ); return [$email, $template, $websiteId]; } }
![Page 43: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/43.jpg)
Declaring Plugin
After
File: Magento\Security\etc\di.xml<config> <type name="Magento\Customer\Model\AccountManagement"> <plugin name="security_check_customer_password_reset_attempt" type="Magento\Security\Model\Plugin\AccountManagement" /> </type> </config>
![Page 44: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/44.jpg)
Interception
Limitations • Final methods / classes • Static class and __construct() methods • Virtual types
Benefits • Public methods • Auto-generated Decorators • Flexible approach • NoninterceptableInterface
![Page 45: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/45.jpg)
Summary
• Solve problems using Design Patterns • Don’t overuse Design Patterns • Build your code on abstractions (interfaces) • Look inside Magento 2 for good practices
![Page 46: Key Insights into Development Design Patterns for Magento 2 · Dispatching an event use Magento\Framework\Event\ManagerInterface; ... Inversion of Control support for Magento 2 Object](https://reader030.fdocuments.us/reader030/viewer/2022021503/5afaf00f7f8b9a2d5d8eeba7/html5/thumbnails/46.jpg)
Ask Me Anything
Thank you
www.maxpronko.commax_pronko