SlideShare una empresa de Scribd logo
1 de 35
Page | 1© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
Best practices in
Magento 2
Based on Multi-Source Inventory (MSI)
project
Page | 2© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
Valeriy Naida
Magento Developer, Multi Source Inventory
Community Engineering Team
Page | 3© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
In one of our directions we have started to work with Community
• Benefit for Magento is creation of new important feature
• Benefit for Community is an increase in knowledge about Magento 2
• Provide a set of best practices how to work with Magento 2 (some
cookbook)
Community Engineering Team
Page | 4© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
• What is API / SPI in Magento 2 (more practice)
• Repository responsibility in Magento 2
• Use Composition instead of Inheritance / Traits
• Object Manager should not be used as a class dependency
…
• There is no silver bullet (Think first!)
Frequently asked questions
Khmelnytskyi Magento Meetup
API / SPI concepts in
Magento 2
Page | 6© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
API - Interfaces for usage (calling) in the client
code
Located in Api subfolder or in the separate module
ApiModule
API
Page | 7© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
SPI - Interfaces that you should extend and
implement to customize current behavior
But NOT expected to be used (called) in the client
code directly
Located near implementation
SPI
Page | 8© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
Q: Can the API and SPI be a single interface?
A: Yes. It often happens. Do not create empty proxy (API to SPI) classes
FAQ
Page | 9© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
Q: Can I call one API from another?
A: Yes. You could create Sugar Service to avoid boilerplate code
=>
• But provide clear DocBlock
• Try to keep a single point of Customization
FAQ
Page | 10© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
Q: What about Resource Model?
A: TBD
Q: When is needed to add SPI?
A: TBD
Q: Why not introduce the @spi annotation?
A: TBD
FAQ
Page | 11© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
1. Main logic is API
2. Steps (strategies) are SPI
Algorithm example
Khmelnytskyi Magento Meetup
Repository responsibility
In Magento 2
Page | 13© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
In Magento 2 Repository is considered as an implementation of Facade
pattern which provides a simplified interface to a larger body of code
responsible for Domain Entity base management
BUT Repository is NOT new kind of “helper”
Facade pattern
Page | 14© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
Repository under hood
Usually typical repository provides the following methods:
Could NOT be wider than methods mentioned above
Page | 15© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
Repository under hood
List of the methods could be shorter if based on the business requirements
particular entity doesn't have some of the operation(-s)
Page | 16© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
Repository under hood
Methods with their own semantic recommended to be put into some dedicated
Services
• Principle Of Least Surprise
• Backward compatibility
Page | 17© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
DDD liked services instead of Repository
Link between Source and Stock doesn’t have sense from business side
Page | 18© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
Repository Implementation
Page | 19© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
1. Repository could be considered as an API - Interface for usage (calling) in
the business logic
2. Separate class-commands to which Repository proxies initial call (like, Get
Save GetList Delete) could be considered as SPI
Repository: API vs SPI segregation
Khmelnytskyi Magento Meetup
Object Manager should
not be used as a class
dependency
Page | 21© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
Generally Object Manager should not be used as a class dependency
Problems:
• Class is hard coded and can not be replaced with a different one
• Would require more work to modify the behavior by third parties
Object Manager
Page | 22© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
There is no good possibility to replace Logger object only for this Class
Example - Problem
Page | 23© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
Example - Solution
Page | 24© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
Object Manager could be used in classes which create objects
(Factories, Builders, Pools)
When Object Manager is applicable
Page | 25© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
May also be used to maintain Backwards Compatibility
When Object Manager is applicable
Khmelnytskyi Magento Meetup
Composition against
Inheritance
Page | 27© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
Inheritance / trait should not be used. Composition should be used
instead
Problems:
• Inheritance enforces dependency on a specific parent class which can not be
replaced in runtime
• Would require more work to modify the behavior by third parties
Inheritance
Page | 28© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
Requires complete replacement of the
renderer, instead of customizing it
Example - Problem
Page | 29© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
• Price Formatter may be easily
replaced by injecting another
dependency in the constructor
• Allows precise modification of
behavior
Example - Solution
Page | 30© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
• Class is a Subtype of another class
• Template Method pattern (usually with Hollywood Principle: Don't call us,
we'll call you)
• You don’t need replaceability
When Inheritance / trait is applicable
Page | 31© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
Provides possibility of saving entity with predefined/pre-generated id (quick
solution in waiting for the ORM)
IS NOT supposed to be replaced
Khmelnytskyi Magento Meetup
Useful Links
Page | 33© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
• Magento 2 Technical Guidelines
http://devdocs.magento.com/guides/v2.2/coding-standards/technical-
guidelines/technical-guidelines.html
• Backward compatible development
http://devdocs.magento.com/guides/v2.2/contributor-guide/backward-
compatible-development/
• Multi-Source Inventory (MSI) project
https://github.com/magento-engcom/msi/wiki
Useful Links
Page | 34© 2017 Magento, Inc. Khmelnytskyi Magento Meetup
Exchange Ideas
Khmelnytskyi Magento Meetup
How to join us? Send an email to
engcom@magento.com
@_naydav
Thank y’all!

Más contenido relacionado

La actualidad más candente

Volodymyr Kublytskyi - Develop Product, Design Platform
Volodymyr Kublytskyi - Develop Product, Design PlatformVolodymyr Kublytskyi - Develop Product, Design Platform
Volodymyr Kublytskyi - Develop Product, Design PlatformMeet Magento Italy
 
Awesome architectures in Magento 2.3
Awesome architectures in Magento 2.3Awesome architectures in Magento 2.3
Awesome architectures in Magento 2.3Alessandro Ronchi
 
Jacopo Nardiello - From CI to Prod: Running Magento at scale with Kubernetes
Jacopo Nardiello - From CI to Prod: Running Magento at scale with KubernetesJacopo Nardiello - From CI to Prod: Running Magento at scale with Kubernetes
Jacopo Nardiello - From CI to Prod: Running Magento at scale with KubernetesMeet Magento Italy
 
James Zetlen - PWA Studio Integration…With You
James Zetlen - PWA Studio Integration…With YouJames Zetlen - PWA Studio Integration…With You
James Zetlen - PWA Studio Integration…With YouMeet Magento Italy
 
Experience in Magento Community Projects
Experience in Magento Community ProjectsExperience in Magento Community Projects
Experience in Magento Community ProjectsMagecom UK Limited
 
Backward Compatibility Developer's Guide in Magento 2. #MM17CZ
Backward Compatibility Developer's Guide in Magento 2. #MM17CZBackward Compatibility Developer's Guide in Magento 2. #MM17CZ
Backward Compatibility Developer's Guide in Magento 2. #MM17CZIgor Miniailo
 
Magento 2 Declarative Schema
Magento 2 Declarative SchemaMagento 2 Declarative Schema
Magento 2 Declarative Schemaatishgoswami
 
Mli 2017 technical EQP & marketplace
Mli 2017 technical EQP & marketplaceMli 2017 technical EQP & marketplace
Mli 2017 technical EQP & marketplaceHanoi MagentoMeetup
 
Mli 2017 technical powering tomorrow_2.2
Mli 2017 technical powering tomorrow_2.2Mli 2017 technical powering tomorrow_2.2
Mli 2017 technical powering tomorrow_2.2Hanoi MagentoMeetup
 
Org-dependent Unlocked Packages for ISVs
Org-dependent Unlocked Packages for ISVsOrg-dependent Unlocked Packages for ISVs
Org-dependent Unlocked Packages for ISVsCodeScience
 
Webinar - Rapise v6.6 | New Features and Enhancements
Webinar - Rapise v6.6 | New Features and EnhancementsWebinar - Rapise v6.6 | New Features and Enhancements
Webinar - Rapise v6.6 | New Features and EnhancementsInflectra
 
Sustainability Challenge, Postman, Rest sheet and Anypoint provider : MuleSof...
Sustainability Challenge, Postman, Rest sheet and Anypoint provider : MuleSof...Sustainability Challenge, Postman, Rest sheet and Anypoint provider : MuleSof...
Sustainability Challenge, Postman, Rest sheet and Anypoint provider : MuleSof...Angel Alberici
 
TRAX technical highlights
TRAX technical highlightsTRAX technical highlights
TRAX technical highlightsESUG
 
Using the Mule 4 SDK to build a connector : MuleSoft Virtual Muleys Meetups
Using the Mule 4 SDK to build a connector  : MuleSoft Virtual Muleys MeetupsUsing the Mule 4 SDK to build a connector  : MuleSoft Virtual Muleys Meetups
Using the Mule 4 SDK to build a connector : MuleSoft Virtual Muleys MeetupsAngel Alberici
 
MuleSoft: How to Engage Partners/Customers and API Led with Alexa
MuleSoft: How to Engage Partners/Customers and  API Led with Alexa MuleSoft: How to Engage Partners/Customers and  API Led with Alexa
MuleSoft: How to Engage Partners/Customers and API Led with Alexa Angel Alberici
 
Major Spira v6.3 Usability & Performance Enhancements Unveiled
Major Spira v6.3 Usability & Performance Enhancements UnveiledMajor Spira v6.3 Usability & Performance Enhancements Unveiled
Major Spira v6.3 Usability & Performance Enhancements UnveiledInflectra
 

La actualidad más candente (17)

Volodymyr Kublytskyi - Develop Product, Design Platform
Volodymyr Kublytskyi - Develop Product, Design PlatformVolodymyr Kublytskyi - Develop Product, Design Platform
Volodymyr Kublytskyi - Develop Product, Design Platform
 
Awesome architectures in Magento 2.3
Awesome architectures in Magento 2.3Awesome architectures in Magento 2.3
Awesome architectures in Magento 2.3
 
Jacopo Nardiello - From CI to Prod: Running Magento at scale with Kubernetes
Jacopo Nardiello - From CI to Prod: Running Magento at scale with KubernetesJacopo Nardiello - From CI to Prod: Running Magento at scale with Kubernetes
Jacopo Nardiello - From CI to Prod: Running Magento at scale with Kubernetes
 
James Zetlen - PWA Studio Integration…With You
James Zetlen - PWA Studio Integration…With YouJames Zetlen - PWA Studio Integration…With You
James Zetlen - PWA Studio Integration…With You
 
Experience in Magento Community Projects
Experience in Magento Community ProjectsExperience in Magento Community Projects
Experience in Magento Community Projects
 
Backward Compatibility Developer's Guide in Magento 2. #MM17CZ
Backward Compatibility Developer's Guide in Magento 2. #MM17CZBackward Compatibility Developer's Guide in Magento 2. #MM17CZ
Backward Compatibility Developer's Guide in Magento 2. #MM17CZ
 
Magento 2 Declarative Schema
Magento 2 Declarative SchemaMagento 2 Declarative Schema
Magento 2 Declarative Schema
 
Mli 2017 technical EQP & marketplace
Mli 2017 technical EQP & marketplaceMli 2017 technical EQP & marketplace
Mli 2017 technical EQP & marketplace
 
Mli 2017 technical powering tomorrow_2.2
Mli 2017 technical powering tomorrow_2.2Mli 2017 technical powering tomorrow_2.2
Mli 2017 technical powering tomorrow_2.2
 
Org-dependent Unlocked Packages for ISVs
Org-dependent Unlocked Packages for ISVsOrg-dependent Unlocked Packages for ISVs
Org-dependent Unlocked Packages for ISVs
 
Webinar - Rapise v6.6 | New Features and Enhancements
Webinar - Rapise v6.6 | New Features and EnhancementsWebinar - Rapise v6.6 | New Features and Enhancements
Webinar - Rapise v6.6 | New Features and Enhancements
 
Manchester Meetup #3
Manchester Meetup #3Manchester Meetup #3
Manchester Meetup #3
 
Sustainability Challenge, Postman, Rest sheet and Anypoint provider : MuleSof...
Sustainability Challenge, Postman, Rest sheet and Anypoint provider : MuleSof...Sustainability Challenge, Postman, Rest sheet and Anypoint provider : MuleSof...
Sustainability Challenge, Postman, Rest sheet and Anypoint provider : MuleSof...
 
TRAX technical highlights
TRAX technical highlightsTRAX technical highlights
TRAX technical highlights
 
Using the Mule 4 SDK to build a connector : MuleSoft Virtual Muleys Meetups
Using the Mule 4 SDK to build a connector  : MuleSoft Virtual Muleys MeetupsUsing the Mule 4 SDK to build a connector  : MuleSoft Virtual Muleys Meetups
Using the Mule 4 SDK to build a connector : MuleSoft Virtual Muleys Meetups
 
MuleSoft: How to Engage Partners/Customers and API Led with Alexa
MuleSoft: How to Engage Partners/Customers and  API Led with Alexa MuleSoft: How to Engage Partners/Customers and  API Led with Alexa
MuleSoft: How to Engage Partners/Customers and API Led with Alexa
 
Major Spira v6.3 Usability & Performance Enhancements Unveiled
Major Spira v6.3 Usability & Performance Enhancements UnveiledMajor Spira v6.3 Usability & Performance Enhancements Unveiled
Major Spira v6.3 Usability & Performance Enhancements Unveiled
 

Similar a Valeriy Nayda - Best Practices in Magento 2. Based on Multi Source Inventory (msi) project

How I ended up touching Magento core
How I ended up touching Magento coreHow I ended up touching Magento core
How I ended up touching Magento coreAlessandro Ronchi
 
MageConf 2017, Design API Best Practices
MageConf 2017, Design API Best PracticesMageConf 2017, Design API Best Practices
MageConf 2017, Design API Best PracticesIgor Miniailo
 
Magento 2 Best Practice MLUK17
Magento 2 Best Practice MLUK17Magento 2 Best Practice MLUK17
Magento 2 Best Practice MLUK17Brent W Peterson
 
Testing in Magento 2
Testing in Magento 2 Testing in Magento 2
Testing in Magento 2 Igor Miniailo
 
How to edit the core
How to edit the coreHow to edit the core
How to edit the coredmanners87
 
Hyvä from a developer perspective
Hyvä from a developer perspectiveHyvä from a developer perspective
Hyvä from a developer perspectivevinaikopp
 
Automated tests in Magento
Automated tests in MagentoAutomated tests in Magento
Automated tests in MagentoYevhen Sentiabov
 
Magento Function Testing Framework - Intro and Overview
Magento Function Testing Framework - Intro and OverviewMagento Function Testing Framework - Intro and Overview
Magento Function Testing Framework - Intro and OverviewTom Erskine
 
MageConf 2020 - Deep dive into an Innovations Lab project - Rafael Correa Gomes
MageConf 2020 - Deep dive into an Innovations Lab project - Rafael Correa GomesMageConf 2020 - Deep dive into an Innovations Lab project - Rafael Correa Gomes
MageConf 2020 - Deep dive into an Innovations Lab project - Rafael Correa GomesRafael Corrêa Gomes
 
API design best practices
API design best practicesAPI design best practices
API design best practicesIgor Miniailo
 
Monitoring your cache effectiveness in Magento 2
Monitoring your cache effectiveness in Magento 2Monitoring your cache effectiveness in Magento 2
Monitoring your cache effectiveness in Magento 2Tony Brown
 
Imagine recap-devhub
Imagine recap-devhubImagine recap-devhub
Imagine recap-devhubMagento Dev
 
12 Things Not to Do on a Portal Project
12 Things Not to Do on a Portal Project12 Things Not to Do on a Portal Project
12 Things Not to Do on a Portal ProjectPerficient, Inc.
 
How I ended up contributing to Magento core
How I ended up contributing to Magento coreHow I ended up contributing to Magento core
How I ended up contributing to Magento coreAlessandro Ronchi
 
Backward Compatibility Developer's Guide in Magento 2
Backward Compatibility Developer's Guide in Magento 2Backward Compatibility Developer's Guide in Magento 2
Backward Compatibility Developer's Guide in Magento 2Igor Miniailo
 
Mli 2017 technical backward compatibility
Mli 2017 technical backward compatibilityMli 2017 technical backward compatibility
Mli 2017 technical backward compatibilityHanoi MagentoMeetup
 
Magento Meetup Nagpur - Saturday, July 18, 2020 | Performance, AI Product Rec...
Magento Meetup Nagpur - Saturday, July 18, 2020 | Performance, AI Product Rec...Magento Meetup Nagpur - Saturday, July 18, 2020 | Performance, AI Product Rec...
Magento Meetup Nagpur - Saturday, July 18, 2020 | Performance, AI Product Rec...atishgoswami
 
Mli 2017 technical m2 developer experience
Mli 2017 technical m2 developer experienceMli 2017 technical m2 developer experience
Mli 2017 technical m2 developer experienceHanoi MagentoMeetup
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introductionwojtek_s
 

Similar a Valeriy Nayda - Best Practices in Magento 2. Based on Multi Source Inventory (msi) project (20)

How I ended up touching Magento core
How I ended up touching Magento coreHow I ended up touching Magento core
How I ended up touching Magento core
 
MageConf 2017, Design API Best Practices
MageConf 2017, Design API Best PracticesMageConf 2017, Design API Best Practices
MageConf 2017, Design API Best Practices
 
Magento 2 Best Practice MLUK17
Magento 2 Best Practice MLUK17Magento 2 Best Practice MLUK17
Magento 2 Best Practice MLUK17
 
Testing in Magento 2
Testing in Magento 2 Testing in Magento 2
Testing in Magento 2
 
How to edit the core
How to edit the coreHow to edit the core
How to edit the core
 
Hyvä from a developer perspective
Hyvä from a developer perspectiveHyvä from a developer perspective
Hyvä from a developer perspective
 
Automated tests in Magento
Automated tests in MagentoAutomated tests in Magento
Automated tests in Magento
 
Magento Function Testing Framework - Intro and Overview
Magento Function Testing Framework - Intro and OverviewMagento Function Testing Framework - Intro and Overview
Magento Function Testing Framework - Intro and Overview
 
Magento Technical guidelines
Magento Technical guidelinesMagento Technical guidelines
Magento Technical guidelines
 
MageConf 2020 - Deep dive into an Innovations Lab project - Rafael Correa Gomes
MageConf 2020 - Deep dive into an Innovations Lab project - Rafael Correa GomesMageConf 2020 - Deep dive into an Innovations Lab project - Rafael Correa Gomes
MageConf 2020 - Deep dive into an Innovations Lab project - Rafael Correa Gomes
 
API design best practices
API design best practicesAPI design best practices
API design best practices
 
Monitoring your cache effectiveness in Magento 2
Monitoring your cache effectiveness in Magento 2Monitoring your cache effectiveness in Magento 2
Monitoring your cache effectiveness in Magento 2
 
Imagine recap-devhub
Imagine recap-devhubImagine recap-devhub
Imagine recap-devhub
 
12 Things Not to Do on a Portal Project
12 Things Not to Do on a Portal Project12 Things Not to Do on a Portal Project
12 Things Not to Do on a Portal Project
 
How I ended up contributing to Magento core
How I ended up contributing to Magento coreHow I ended up contributing to Magento core
How I ended up contributing to Magento core
 
Backward Compatibility Developer's Guide in Magento 2
Backward Compatibility Developer's Guide in Magento 2Backward Compatibility Developer's Guide in Magento 2
Backward Compatibility Developer's Guide in Magento 2
 
Mli 2017 technical backward compatibility
Mli 2017 technical backward compatibilityMli 2017 technical backward compatibility
Mli 2017 technical backward compatibility
 
Magento Meetup Nagpur - Saturday, July 18, 2020 | Performance, AI Product Rec...
Magento Meetup Nagpur - Saturday, July 18, 2020 | Performance, AI Product Rec...Magento Meetup Nagpur - Saturday, July 18, 2020 | Performance, AI Product Rec...
Magento Meetup Nagpur - Saturday, July 18, 2020 | Performance, AI Product Rec...
 
Mli 2017 technical m2 developer experience
Mli 2017 technical m2 developer experienceMli 2017 technical m2 developer experience
Mli 2017 technical m2 developer experience
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introduction
 

Más de Atwix

Yaroslav Rogoza - Development Environment: Local or Remote?
Yaroslav Rogoza - Development Environment: Local or Remote?Yaroslav Rogoza - Development Environment: Local or Remote?
Yaroslav Rogoza - Development Environment: Local or Remote?Atwix
 
Magento 2 performance comparison in different environments by Yaroslav Rogoza...
Magento 2 performance comparison in different environments by Yaroslav Rogoza...Magento 2 performance comparison in different environments by Yaroslav Rogoza...
Magento 2 performance comparison in different environments by Yaroslav Rogoza...Atwix
 
Viacheslav Kravchuk. Working as a distributed company. Our journey. Meet Mage...
Viacheslav Kravchuk. Working as a distributed company. Our journey. Meet Mage...Viacheslav Kravchuk. Working as a distributed company. Our journey. Meet Mage...
Viacheslav Kravchuk. Working as a distributed company. Our journey. Meet Mage...Atwix
 
Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2
Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2
Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2Atwix
 
Александр Смага, Юрий Муратов - Meet Magento Ukraine - Технический обзор OroCRM
Александр Смага, Юрий Муратов - Meet Magento Ukraine - Технический обзор OroCRM Александр Смага, Юрий Муратов - Meet Magento Ukraine - Технический обзор OroCRM
Александр Смага, Юрий Муратов - Meet Magento Ukraine - Технический обзор OroCRM Atwix
 
Иван Чепурный - Meet Magento Ukraine - Varnish Cache and its usage in the rea...
Иван Чепурный - Meet Magento Ukraine - Varnish Cache and its usage in the rea...Иван Чепурный - Meet Magento Ukraine - Varnish Cache and its usage in the rea...
Иван Чепурный - Meet Magento Ukraine - Varnish Cache and its usage in the rea...Atwix
 
Владимир Дубина - Meet Magento Ukraine - Data consistency
Владимир Дубина - Meet Magento Ukraine - Data consistencyВладимир Дубина - Meet Magento Ukraine - Data consistency
Владимир Дубина - Meet Magento Ukraine - Data consistencyAtwix
 
Андрей Самиляк - Meet Magento Ukraine - Как мы играли в DevOps и как получилс...
Андрей Самиляк - Meet Magento Ukraine - Как мы играли в DevOps и как получилс...Андрей Самиляк - Meet Magento Ukraine - Как мы играли в DevOps и как получилс...
Андрей Самиляк - Meet Magento Ukraine - Как мы играли в DevOps и как получилс...Atwix
 
Сергей Кибиткин - Meet Magento Ukraine - Что вы никогда не сделаете в Magento
Сергей Кибиткин - Meet Magento Ukraine - Что вы никогда не сделаете в MagentoСергей Кибиткин - Meet Magento Ukraine - Что вы никогда не сделаете в Magento
Сергей Кибиткин - Meet Magento Ukraine - Что вы никогда не сделаете в MagentoAtwix
 
Макс Екатериненко - Meet Magento Ukraine - Magento 2 Overview
Макс Екатериненко - Meet Magento Ukraine - Magento 2 OverviewМакс Екатериненко - Meet Magento Ukraine - Magento 2 Overview
Макс Екатериненко - Meet Magento Ukraine - Magento 2 OverviewAtwix
 
Александр Каранда - Meet Magento Ukraine - Реальность нереальных вещей
Александр Каранда - Meet Magento Ukraine - Реальность нереальных вещейАлександр Каранда - Meet Magento Ukraine - Реальность нереальных вещей
Александр Каранда - Meet Magento Ukraine - Реальность нереальных вещейAtwix
 
Антон Капля - Meet Magento Ukraine - Кодогенератор в Magento
Антон Капля - Meet Magento Ukraine - Кодогенератор в MagentoАнтон Капля - Meet Magento Ukraine - Кодогенератор в Magento
Антон Капля - Meet Magento Ukraine - Кодогенератор в MagentoAtwix
 
Анатолій Денис - Meet Magento Ukraine - Migration to Magento - mission possible
Анатолій Денис - Meet Magento Ukraine - Migration to Magento - mission possibleАнатолій Денис - Meet Magento Ukraine - Migration to Magento - mission possible
Анатолій Денис - Meet Magento Ukraine - Migration to Magento - mission possibleAtwix
 
Артем Кузнецов - Meet Magento Ukraine - инструменты для отдела поддержки, опы...
Артем Кузнецов - Meet Magento Ukraine - инструменты для отдела поддержки, опы...Артем Кузнецов - Meet Magento Ukraine - инструменты для отдела поддержки, опы...
Артем Кузнецов - Meet Magento Ukraine - инструменты для отдела поддержки, опы...Atwix
 
Александр Стельмах - Meet Magento Ukraine - Прибыльная e-mail рассылка за 5 ш...
Александр Стельмах - Meet Magento Ukraine - Прибыльная e-mail рассылка за 5 ш...Александр Стельмах - Meet Magento Ukraine - Прибыльная e-mail рассылка за 5 ш...
Александр Стельмах - Meet Magento Ukraine - Прибыльная e-mail рассылка за 5 ш...Atwix
 
Владимир Галика - Meet Magento Ukraine - Чудесный Новый Мир – почему продвиже...
Владимир Галика - Meet Magento Ukraine - Чудесный Новый Мир – почему продвиже...Владимир Галика - Meet Magento Ukraine - Чудесный Новый Мир – почему продвиже...
Владимир Галика - Meet Magento Ukraine - Чудесный Новый Мир – почему продвиже...Atwix
 
Александр Колб - Meet Magento Ukraine - психология потребления онлайн
Александр Колб - Meet Magento Ukraine - психология потребления онлайнАлександр Колб - Meet Magento Ukraine - психология потребления онлайн
Александр Колб - Meet Magento Ukraine - психология потребления онлайнAtwix
 
Елена Леонова - Meet Magento Ukraine - Трасформация в e-commerce с Magento
Елена Леонова - Meet Magento Ukraine - Трасформация в e-commerce с MagentoЕлена Леонова - Meet Magento Ukraine - Трасформация в e-commerce с Magento
Елена Леонова - Meet Magento Ukraine - Трасформация в e-commerce с MagentoAtwix
 
Thomas Fleck - Meet Magento Ukraine - How Magento and open source change the ...
Thomas Fleck - Meet Magento Ukraine - How Magento and open source change the ...Thomas Fleck - Meet Magento Ukraine - How Magento and open source change the ...
Thomas Fleck - Meet Magento Ukraine - How Magento and open source change the ...Atwix
 
Артем Сухорослов - Meet Magento Ukraine - Коммерсанты vs. инженеры как помир...
Артем Сухорослов - Meet Magento Ukraine -  Коммерсанты vs. инженеры как помир...Артем Сухорослов - Meet Magento Ukraine -  Коммерсанты vs. инженеры как помир...
Артем Сухорослов - Meet Magento Ukraine - Коммерсанты vs. инженеры как помир...Atwix
 

Más de Atwix (20)

Yaroslav Rogoza - Development Environment: Local or Remote?
Yaroslav Rogoza - Development Environment: Local or Remote?Yaroslav Rogoza - Development Environment: Local or Remote?
Yaroslav Rogoza - Development Environment: Local or Remote?
 
Magento 2 performance comparison in different environments by Yaroslav Rogoza...
Magento 2 performance comparison in different environments by Yaroslav Rogoza...Magento 2 performance comparison in different environments by Yaroslav Rogoza...
Magento 2 performance comparison in different environments by Yaroslav Rogoza...
 
Viacheslav Kravchuk. Working as a distributed company. Our journey. Meet Mage...
Viacheslav Kravchuk. Working as a distributed company. Our journey. Meet Mage...Viacheslav Kravchuk. Working as a distributed company. Our journey. Meet Mage...
Viacheslav Kravchuk. Working as a distributed company. Our journey. Meet Mage...
 
Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2
Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2
Сергей Иващенко - Meet Magento Ukraine - Цены в Magento 2
 
Александр Смага, Юрий Муратов - Meet Magento Ukraine - Технический обзор OroCRM
Александр Смага, Юрий Муратов - Meet Magento Ukraine - Технический обзор OroCRM Александр Смага, Юрий Муратов - Meet Magento Ukraine - Технический обзор OroCRM
Александр Смага, Юрий Муратов - Meet Magento Ukraine - Технический обзор OroCRM
 
Иван Чепурный - Meet Magento Ukraine - Varnish Cache and its usage in the rea...
Иван Чепурный - Meet Magento Ukraine - Varnish Cache and its usage in the rea...Иван Чепурный - Meet Magento Ukraine - Varnish Cache and its usage in the rea...
Иван Чепурный - Meet Magento Ukraine - Varnish Cache and its usage in the rea...
 
Владимир Дубина - Meet Magento Ukraine - Data consistency
Владимир Дубина - Meet Magento Ukraine - Data consistencyВладимир Дубина - Meet Magento Ukraine - Data consistency
Владимир Дубина - Meet Magento Ukraine - Data consistency
 
Андрей Самиляк - Meet Magento Ukraine - Как мы играли в DevOps и как получилс...
Андрей Самиляк - Meet Magento Ukraine - Как мы играли в DevOps и как получилс...Андрей Самиляк - Meet Magento Ukraine - Как мы играли в DevOps и как получилс...
Андрей Самиляк - Meet Magento Ukraine - Как мы играли в DevOps и как получилс...
 
Сергей Кибиткин - Meet Magento Ukraine - Что вы никогда не сделаете в Magento
Сергей Кибиткин - Meet Magento Ukraine - Что вы никогда не сделаете в MagentoСергей Кибиткин - Meet Magento Ukraine - Что вы никогда не сделаете в Magento
Сергей Кибиткин - Meet Magento Ukraine - Что вы никогда не сделаете в Magento
 
Макс Екатериненко - Meet Magento Ukraine - Magento 2 Overview
Макс Екатериненко - Meet Magento Ukraine - Magento 2 OverviewМакс Екатериненко - Meet Magento Ukraine - Magento 2 Overview
Макс Екатериненко - Meet Magento Ukraine - Magento 2 Overview
 
Александр Каранда - Meet Magento Ukraine - Реальность нереальных вещей
Александр Каранда - Meet Magento Ukraine - Реальность нереальных вещейАлександр Каранда - Meet Magento Ukraine - Реальность нереальных вещей
Александр Каранда - Meet Magento Ukraine - Реальность нереальных вещей
 
Антон Капля - Meet Magento Ukraine - Кодогенератор в Magento
Антон Капля - Meet Magento Ukraine - Кодогенератор в MagentoАнтон Капля - Meet Magento Ukraine - Кодогенератор в Magento
Антон Капля - Meet Magento Ukraine - Кодогенератор в Magento
 
Анатолій Денис - Meet Magento Ukraine - Migration to Magento - mission possible
Анатолій Денис - Meet Magento Ukraine - Migration to Magento - mission possibleАнатолій Денис - Meet Magento Ukraine - Migration to Magento - mission possible
Анатолій Денис - Meet Magento Ukraine - Migration to Magento - mission possible
 
Артем Кузнецов - Meet Magento Ukraine - инструменты для отдела поддержки, опы...
Артем Кузнецов - Meet Magento Ukraine - инструменты для отдела поддержки, опы...Артем Кузнецов - Meet Magento Ukraine - инструменты для отдела поддержки, опы...
Артем Кузнецов - Meet Magento Ukraine - инструменты для отдела поддержки, опы...
 
Александр Стельмах - Meet Magento Ukraine - Прибыльная e-mail рассылка за 5 ш...
Александр Стельмах - Meet Magento Ukraine - Прибыльная e-mail рассылка за 5 ш...Александр Стельмах - Meet Magento Ukraine - Прибыльная e-mail рассылка за 5 ш...
Александр Стельмах - Meet Magento Ukraine - Прибыльная e-mail рассылка за 5 ш...
 
Владимир Галика - Meet Magento Ukraine - Чудесный Новый Мир – почему продвиже...
Владимир Галика - Meet Magento Ukraine - Чудесный Новый Мир – почему продвиже...Владимир Галика - Meet Magento Ukraine - Чудесный Новый Мир – почему продвиже...
Владимир Галика - Meet Magento Ukraine - Чудесный Новый Мир – почему продвиже...
 
Александр Колб - Meet Magento Ukraine - психология потребления онлайн
Александр Колб - Meet Magento Ukraine - психология потребления онлайнАлександр Колб - Meet Magento Ukraine - психология потребления онлайн
Александр Колб - Meet Magento Ukraine - психология потребления онлайн
 
Елена Леонова - Meet Magento Ukraine - Трасформация в e-commerce с Magento
Елена Леонова - Meet Magento Ukraine - Трасформация в e-commerce с MagentoЕлена Леонова - Meet Magento Ukraine - Трасформация в e-commerce с Magento
Елена Леонова - Meet Magento Ukraine - Трасформация в e-commerce с Magento
 
Thomas Fleck - Meet Magento Ukraine - How Magento and open source change the ...
Thomas Fleck - Meet Magento Ukraine - How Magento and open source change the ...Thomas Fleck - Meet Magento Ukraine - How Magento and open source change the ...
Thomas Fleck - Meet Magento Ukraine - How Magento and open source change the ...
 
Артем Сухорослов - Meet Magento Ukraine - Коммерсанты vs. инженеры как помир...
Артем Сухорослов - Meet Magento Ukraine -  Коммерсанты vs. инженеры как помир...Артем Сухорослов - Meet Magento Ukraine -  Коммерсанты vs. инженеры как помир...
Артем Сухорослов - Meet Magento Ukraine - Коммерсанты vs. инженеры как помир...
 

Último

办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 
Q4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxQ4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxeditsforyah
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhimiss dipika
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Excelmac1
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书zdzoqco
 
NSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentationNSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentationMarko4394
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predieusebiomeyer
 
Elevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New OrleansElevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New Orleanscorenetworkseo
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxDyna Gilbert
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMartaLoveguard
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一Fs
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Paul Calvano
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Sonam Pathan
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一Fs
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa494f574xmv
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Sonam Pathan
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书rnrncn29
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationLinaWolf1
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一Fs
 

Último (20)

办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 
Q4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxQ4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptx
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhi
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
 
NSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentationNSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentation
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predi
 
Elevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New OrleansElevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New Orleans
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptx
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptx
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 Documentation
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
 

Valeriy Nayda - Best Practices in Magento 2. Based on Multi Source Inventory (msi) project

  • 1. Page | 1© 2017 Magento, Inc. Khmelnytskyi Magento Meetup Best practices in Magento 2 Based on Multi-Source Inventory (MSI) project
  • 2. Page | 2© 2017 Magento, Inc. Khmelnytskyi Magento Meetup Valeriy Naida Magento Developer, Multi Source Inventory Community Engineering Team
  • 3. Page | 3© 2017 Magento, Inc. Khmelnytskyi Magento Meetup In one of our directions we have started to work with Community • Benefit for Magento is creation of new important feature • Benefit for Community is an increase in knowledge about Magento 2 • Provide a set of best practices how to work with Magento 2 (some cookbook) Community Engineering Team
  • 4. Page | 4© 2017 Magento, Inc. Khmelnytskyi Magento Meetup • What is API / SPI in Magento 2 (more practice) • Repository responsibility in Magento 2 • Use Composition instead of Inheritance / Traits • Object Manager should not be used as a class dependency … • There is no silver bullet (Think first!) Frequently asked questions
  • 5. Khmelnytskyi Magento Meetup API / SPI concepts in Magento 2
  • 6. Page | 6© 2017 Magento, Inc. Khmelnytskyi Magento Meetup API - Interfaces for usage (calling) in the client code Located in Api subfolder or in the separate module ApiModule API
  • 7. Page | 7© 2017 Magento, Inc. Khmelnytskyi Magento Meetup SPI - Interfaces that you should extend and implement to customize current behavior But NOT expected to be used (called) in the client code directly Located near implementation SPI
  • 8. Page | 8© 2017 Magento, Inc. Khmelnytskyi Magento Meetup Q: Can the API and SPI be a single interface? A: Yes. It often happens. Do not create empty proxy (API to SPI) classes FAQ
  • 9. Page | 9© 2017 Magento, Inc. Khmelnytskyi Magento Meetup Q: Can I call one API from another? A: Yes. You could create Sugar Service to avoid boilerplate code => • But provide clear DocBlock • Try to keep a single point of Customization FAQ
  • 10. Page | 10© 2017 Magento, Inc. Khmelnytskyi Magento Meetup Q: What about Resource Model? A: TBD Q: When is needed to add SPI? A: TBD Q: Why not introduce the @spi annotation? A: TBD FAQ
  • 11. Page | 11© 2017 Magento, Inc. Khmelnytskyi Magento Meetup 1. Main logic is API 2. Steps (strategies) are SPI Algorithm example
  • 12. Khmelnytskyi Magento Meetup Repository responsibility In Magento 2
  • 13. Page | 13© 2017 Magento, Inc. Khmelnytskyi Magento Meetup In Magento 2 Repository is considered as an implementation of Facade pattern which provides a simplified interface to a larger body of code responsible for Domain Entity base management BUT Repository is NOT new kind of “helper” Facade pattern
  • 14. Page | 14© 2017 Magento, Inc. Khmelnytskyi Magento Meetup Repository under hood Usually typical repository provides the following methods: Could NOT be wider than methods mentioned above
  • 15. Page | 15© 2017 Magento, Inc. Khmelnytskyi Magento Meetup Repository under hood List of the methods could be shorter if based on the business requirements particular entity doesn't have some of the operation(-s)
  • 16. Page | 16© 2017 Magento, Inc. Khmelnytskyi Magento Meetup Repository under hood Methods with their own semantic recommended to be put into some dedicated Services • Principle Of Least Surprise • Backward compatibility
  • 17. Page | 17© 2017 Magento, Inc. Khmelnytskyi Magento Meetup DDD liked services instead of Repository Link between Source and Stock doesn’t have sense from business side
  • 18. Page | 18© 2017 Magento, Inc. Khmelnytskyi Magento Meetup Repository Implementation
  • 19. Page | 19© 2017 Magento, Inc. Khmelnytskyi Magento Meetup 1. Repository could be considered as an API - Interface for usage (calling) in the business logic 2. Separate class-commands to which Repository proxies initial call (like, Get Save GetList Delete) could be considered as SPI Repository: API vs SPI segregation
  • 20. Khmelnytskyi Magento Meetup Object Manager should not be used as a class dependency
  • 21. Page | 21© 2017 Magento, Inc. Khmelnytskyi Magento Meetup Generally Object Manager should not be used as a class dependency Problems: • Class is hard coded and can not be replaced with a different one • Would require more work to modify the behavior by third parties Object Manager
  • 22. Page | 22© 2017 Magento, Inc. Khmelnytskyi Magento Meetup There is no good possibility to replace Logger object only for this Class Example - Problem
  • 23. Page | 23© 2017 Magento, Inc. Khmelnytskyi Magento Meetup Example - Solution
  • 24. Page | 24© 2017 Magento, Inc. Khmelnytskyi Magento Meetup Object Manager could be used in classes which create objects (Factories, Builders, Pools) When Object Manager is applicable
  • 25. Page | 25© 2017 Magento, Inc. Khmelnytskyi Magento Meetup May also be used to maintain Backwards Compatibility When Object Manager is applicable
  • 27. Page | 27© 2017 Magento, Inc. Khmelnytskyi Magento Meetup Inheritance / trait should not be used. Composition should be used instead Problems: • Inheritance enforces dependency on a specific parent class which can not be replaced in runtime • Would require more work to modify the behavior by third parties Inheritance
  • 28. Page | 28© 2017 Magento, Inc. Khmelnytskyi Magento Meetup Requires complete replacement of the renderer, instead of customizing it Example - Problem
  • 29. Page | 29© 2017 Magento, Inc. Khmelnytskyi Magento Meetup • Price Formatter may be easily replaced by injecting another dependency in the constructor • Allows precise modification of behavior Example - Solution
  • 30. Page | 30© 2017 Magento, Inc. Khmelnytskyi Magento Meetup • Class is a Subtype of another class • Template Method pattern (usually with Hollywood Principle: Don't call us, we'll call you) • You don’t need replaceability When Inheritance / trait is applicable
  • 31. Page | 31© 2017 Magento, Inc. Khmelnytskyi Magento Meetup Provides possibility of saving entity with predefined/pre-generated id (quick solution in waiting for the ORM) IS NOT supposed to be replaced
  • 33. Page | 33© 2017 Magento, Inc. Khmelnytskyi Magento Meetup • Magento 2 Technical Guidelines http://devdocs.magento.com/guides/v2.2/coding-standards/technical- guidelines/technical-guidelines.html • Backward compatible development http://devdocs.magento.com/guides/v2.2/contributor-guide/backward- compatible-development/ • Multi-Source Inventory (MSI) project https://github.com/magento-engcom/msi/wiki Useful Links
  • 34. Page | 34© 2017 Magento, Inc. Khmelnytskyi Magento Meetup Exchange Ideas
  • 35. Khmelnytskyi Magento Meetup How to join us? Send an email to engcom@magento.com @_naydav Thank y’all!