SlideShare una empresa de Scribd logo
1 de 54
© 2017 Magento, Inc. Page | 1 ‘17
API Design
Best practices
Igor Miniailo
Magento Architect
© 2017 Magento, Inc. Page | 2 ‘17
© 2017 Magento, Inc. Page | 3 ‘17
© 2017 Magento, Inc. Page | 4 ‘17
Why is API so crucial?
© 2017 Magento, Inc. Page | 5 ‘17
© 2017 Magento, Inc. Page | 6 ‘17
© 2017 Magento, Inc. Page | 7 ‘17
© 2017 Magento, Inc. Page | 8 ‘17
Semantic Versioning
Version numbers are in the format
MAJOR.MINOR.PATCH, where:
– MAJOR indicates incompatible API changes
– MINOR indicates backward-compatible
functionality has been added
– PATCH indicates backward-compatible bug
fixes
© 2017 Magento, Inc. Page | 9 ‘17
The backward compatibility policy
applies to PHP code annotated with
@api
© 2017 Magento, Inc. Page | 10 ‘17
Public and Private code
© 2017 Magento, Inc. Page | 11 ‘17
Public vs Private code
Private code is not supposed to
be used by third party modules,
so, in most cases, its
modifications will only trigger
PATCH version bumps.
Changes in public code always
trigger MINOR or MAJOR
version bumps.
© 2017 Magento, Inc. Page | 12 ‘17
What examples of Public code Magento has?
• PHP Interface (marked with @api)
• PHP Class (marked with @api)
• Javascript Interface (marked with @api)
• Javascript Class (marked with @api)
• Virtual Type (marked with @api)
• URL paths
• Console commands and their arguments
• Less Variables & Mixins
• Message queue topics and their data types
• UI component declarations
• Layout handles declared by modules
• Events triggered by component (both static dynamic)
• Schema of configuration types introduced by module
• Structure of System Configuration fields used by module
© 2017 Magento, Inc. Page | 13 ‘17
API vs SPI (Extension Points)
A PHP Interface in Magento can be used several ways by the core
product and extension developers.
• As an API. is a set of interfaces and their
implementations that a module provides to other
modules
• As a Service Provider Interface (SPI). is a set of
interfaces that a module uses internally and allows their
implementation by other modules.
• As both. APIs and SPIs are not mutually exclusive.
© 2017 Magento, Inc. Page | 14 ‘17
After the code is released, both API and SPI can
be evolved in a backwards-compatible way. But
both have their specific limitations.
© 2017 Magento, Inc. Page | 15 ‘17
© 2017 Magento, Inc. Page | 16 ‘17
© 2017 Magento, Inc. Page | 17 ‘17
© 2017 Magento, Inc. Page | 18 ‘17
© 2017 Magento, Inc. Page | 19 ‘17
© 2017 Magento, Inc. Page | 20 ‘17
We do not distinguish them separately.
SPIs are annotated the same as APIs.
© 2017 Magento, Inc. Page | 21 ‘17
Who decides whether interface/class belong to API or SPI?
YOU
© 2017 Magento, Inc. Page | 22 ‘17
Dependency Rules API
If a module uses (calls) an API, it should be dependent on the MAJOR
version.
API dependency example
{
...
"require": {
"magento/module-customer": "~100.0", // (>=100.0 <101.0.0)
},
...
}
© 2017 Magento, Inc. Page | 23 ‘17
Dependency Rules SPI
If a module implements an API/SPI, it should be dependent on the
MAJOR+MINOR version.
SPI dependency example
{
...
"require": {
"magento/module-customer": "~100.0.0", // (>=100.0.0 <100.1.0)
},
...
}
© 2017 Magento, Inc. Page | 24 ‘17
http://devdocs.magento.com/guides/v2.1/release-notes/backward-
incompatible-changes-2.1.html
© 2017 Magento, Inc. Page | 25 ‘17
Prohibited Code Changes
© 2017 Magento, Inc. Page | 26 ‘17
• Interface/class removal
• Public & protected method removal
• Introduction of a method to a class or
interface
PHP - Prohibited Code Changes
© 2017 Magento, Inc. Page | 27 ‘17
MagentoCatalogApiCategoryRepositoryInterface
© 2017 Magento, Inc. Page | 28 ‘17
MagentoCatalogApiCategoryListInterface
© 2017 Magento, Inc. Page | 29 ‘17
PHP - Prohibited Code Changes
• Static function removal
• Parameter addition in public methods
• Parameter addition in protected
methods
© 2017 Magento, Inc. Page | 30 ‘17
© 2017 Magento, Inc. Page | 31 ‘17
PHP - Prohibited Code Changes
• Method argument type modification
• Modification of types of thrown
exceptions (unless a new exception is
a subtype of the old one)
• Constructor modification
© 2017 Magento, Inc. Page | 32 ‘17
class ExistingClass
{
/**
* @var NewDependencyInterface $newDependency
*/
private $newDependency;
public function __construct(
OldDependencyIntreface $oldDependency,
$oldRequiredConstructorParameter,
$oldOptinalConstructorParameter = null,
NewDependencyInterface $newDependency = null
) {
...
$this>newDependency = $newDependency ?: MagentoFrameworkAppObjectManager::getInstance()
->get(NewDependencyInterface::class);
...
}
public function existingFunction() {
// Existing functionality
...
// Use $this->newDependency wherever the new dependency is needed
...
}
}
© 2017 Magento, Inc. Page | 33 ‘17
PHP - Prohibited Code Changes
• Modifying the default values of
optional arguments in public and
protected methods
• Removing or renaming constants
© 2017 Magento, Inc. Page | 34 ‘17
The main rule is that backwards compatibility
is more important than niceness and effort of
the implementation.
© 2017 Magento, Inc. Page | 35 ‘17
Coupling Between Objects Reaches Its Limit with
a New Dependency
© 2017 Magento, Inc. Page | 36 ‘17
We MUST do continuous Refactoring!
Backward Compatibility should not be an excuse
for not doing refactoring!
© 2017 Magento, Inc. Page | 37 ‘17
Backward Compatible Fix
*it works (most of the time), but code quality
is far from good enough
© 2017 Magento, Inc. Page | 38 ‘17
Good object oriented programming in the service layer is basically
functional programming:
• constructor injection
• immutable state
• single responsibility principle
• uniform interfaces
• value objects passed across services
Bringing these concepts to an extreme leads to single-method,
immutable objects.
© 2017 Magento, Inc. Page | 39 ‘17
© 2017 Magento, Inc. Page | 40 ‘17
Ubiquitous language matters
© 2017 Magento, Inc. Page | 41 ‘17
Why to use `execute` but not __invoke?
© 2017 Magento, Inc. Page | 42 ‘17
Proposal to move towards Functional Objects
© 2017 Magento, Inc. Page | 43 ‘17
© 2017 Magento, Inc. Page | 44 ‘17
Pros
The main reason for __invoke usage proposal was elimination of
unneeded `execute` methods,
which look a bit artificial and redundant here
© 2017 Magento, Inc. Page | 45 ‘17
Cons
No autocomplete in
PHP Storm IDE
accessing via $this
© 2017 Magento, Inc. Page | 46 ‘17
Cons
© 2017 Magento, Inc. Page | 47 ‘17
Cons
Unit tests look frustrating and non intuitive
© 2017 Magento, Inc. Page | 48 ‘17
Repositories
In Magento 2 Repositories are considered as an implementation
of Facade pattern which provides a simplified interface to a larger body
of code responsible for Domain Entity management.
The main intention is to make API more readable and reduce
dependencies of business logic code on the inner workings of a
module, since most code uses the facade, thus allowing more flexibility
in developing the system.
© 2017 Magento, Inc. Page | 49 ‘17
Repositories
© 2017 Magento, Inc. Page | 50 ‘17
© 2017 Magento, Inc. Page | 51 ‘17
© 2017 Magento, Inc. Page | 52 ‘17
Good API design
Don't make your client do anything you can do
for them (this reduces the amount of boilerplate
code your client will have)
© 2017 Magento, Inc. Page | 53 ‘17
© 2017 Magento, Inc. Page | 54 ‘17
Q & A
@iminyaylo
engcom@magento.com

Más contenido relacionado

La actualidad más candente

Comparison Between Angular 11 vs 12 vs 13.pdf
Comparison Between Angular 11 vs 12 vs 13.pdfComparison Between Angular 11 vs 12 vs 13.pdf
Comparison Between Angular 11 vs 12 vs 13.pdfWPWeb Infotech
 
WSO2 Product Release Webinar - WSO2 App Factory 2.1
WSO2 Product Release Webinar - WSO2 App Factory 2.1WSO2 Product Release Webinar - WSO2 App Factory 2.1
WSO2 Product Release Webinar - WSO2 App Factory 2.1WSO2
 
API First Workflow: How could we have better API Docs through DevOps pipeline
API First Workflow: How could we have better API Docs through DevOps pipelineAPI First Workflow: How could we have better API Docs through DevOps pipeline
API First Workflow: How could we have better API Docs through DevOps pipelinePronovix
 
API designing with WSO2 API Manager
API designing with WSO2 API ManagerAPI designing with WSO2 API Manager
API designing with WSO2 API ManagerWSO2
 
API first approach for frontend developers
API first approach for frontend developersAPI first approach for frontend developers
API first approach for frontend developersFDConf
 
Lessons from the Trenches: Building an API-Centric Architecture
Lessons from the Trenches: Building an API-Centric ArchitectureLessons from the Trenches: Building an API-Centric Architecture
Lessons from the Trenches: Building an API-Centric ArchitectureWSO2
 
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
 
SAP Business One Integration Certificate
SAP Business One Integration CertificateSAP Business One Integration Certificate
SAP Business One Integration CertificateThe RIC Group
 
Consumer Driven Contracts and Your Microservice Architecture
Consumer Driven Contracts and Your Microservice ArchitectureConsumer Driven Contracts and Your Microservice Architecture
Consumer Driven Contracts and Your Microservice ArchitectureMarcin Grzejszczak
 
Highlights of WSO2 API Manager 4.0.0
Highlights of WSO2 API Manager 4.0.0Highlights of WSO2 API Manager 4.0.0
Highlights of WSO2 API Manager 4.0.0WSO2
 
APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...
APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...
APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...Restlet
 
API Revisions - WSO2 API Manager Community Call (10/27/2021)
API Revisions - WSO2 API Manager Community Call (10/27/2021)API Revisions - WSO2 API Manager Community Call (10/27/2021)
API Revisions - WSO2 API Manager Community Call (10/27/2021)WSO2
 
[Open Source Summit 2019] Microservices with Ballerina
[Open Source Summit 2019] Microservices with Ballerina[Open Source Summit 2019] Microservices with Ballerina
[Open Source Summit 2019] Microservices with BallerinaWSO2
 
Consumer-driven contracts with Pact and PHP
Consumer-driven contracts with Pact and PHPConsumer-driven contracts with Pact and PHP
Consumer-driven contracts with Pact and PHPAndy Kelk
 
20140515 BTUG.be - Integration with SAP 101
20140515 BTUG.be - Integration with SAP 10120140515 BTUG.be - Integration with SAP 101
20140515 BTUG.be - Integration with SAP 101BTUGbe
 
AppeX and JavaScript Support Enhancements in Cincom Smalltalk
AppeX and JavaScript Support Enhancements in Cincom SmalltalkAppeX and JavaScript Support Enhancements in Cincom Smalltalk
AppeX and JavaScript Support Enhancements in Cincom SmalltalkESUG
 
Presentation at the 2016 Linux Foundation Collab Summit
Presentation at the 2016 Linux Foundation Collab SummitPresentation at the 2016 Linux Foundation Collab Summit
Presentation at the 2016 Linux Foundation Collab SummitOpen API Initiative (OAI)
 
Microservices: Consumer Driven Contracts in Practice
Microservices: Consumer Driven Contracts in PracticeMicroservices: Consumer Driven Contracts in Practice
Microservices: Consumer Driven Contracts in PracticeQaiser Mazhar
 
Vizag mulesoft-meetup-6-anypoint-datagraph--v2
Vizag mulesoft-meetup-6-anypoint-datagraph--v2Vizag mulesoft-meetup-6-anypoint-datagraph--v2
Vizag mulesoft-meetup-6-anypoint-datagraph--v2Ravi Tamada
 
News about UI5 that you absolutely have to know (UI5con 2017)
News about UI5 that you absolutely have to know (UI5con 2017)News about UI5 that you absolutely have to know (UI5con 2017)
News about UI5 that you absolutely have to know (UI5con 2017)Stefan Beck
 

La actualidad más candente (20)

Comparison Between Angular 11 vs 12 vs 13.pdf
Comparison Between Angular 11 vs 12 vs 13.pdfComparison Between Angular 11 vs 12 vs 13.pdf
Comparison Between Angular 11 vs 12 vs 13.pdf
 
WSO2 Product Release Webinar - WSO2 App Factory 2.1
WSO2 Product Release Webinar - WSO2 App Factory 2.1WSO2 Product Release Webinar - WSO2 App Factory 2.1
WSO2 Product Release Webinar - WSO2 App Factory 2.1
 
API First Workflow: How could we have better API Docs through DevOps pipeline
API First Workflow: How could we have better API Docs through DevOps pipelineAPI First Workflow: How could we have better API Docs through DevOps pipeline
API First Workflow: How could we have better API Docs through DevOps pipeline
 
API designing with WSO2 API Manager
API designing with WSO2 API ManagerAPI designing with WSO2 API Manager
API designing with WSO2 API Manager
 
API first approach for frontend developers
API first approach for frontend developersAPI first approach for frontend developers
API first approach for frontend developers
 
Lessons from the Trenches: Building an API-Centric Architecture
Lessons from the Trenches: Building an API-Centric ArchitectureLessons from the Trenches: Building an API-Centric Architecture
Lessons from the Trenches: Building an API-Centric Architecture
 
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
 
SAP Business One Integration Certificate
SAP Business One Integration CertificateSAP Business One Integration Certificate
SAP Business One Integration Certificate
 
Consumer Driven Contracts and Your Microservice Architecture
Consumer Driven Contracts and Your Microservice ArchitectureConsumer Driven Contracts and Your Microservice Architecture
Consumer Driven Contracts and Your Microservice Architecture
 
Highlights of WSO2 API Manager 4.0.0
Highlights of WSO2 API Manager 4.0.0Highlights of WSO2 API Manager 4.0.0
Highlights of WSO2 API Manager 4.0.0
 
APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...
APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...
APIdays Paris 2014 - Workshop - Craft and Deploy Your API in a Few Clicks Wit...
 
API Revisions - WSO2 API Manager Community Call (10/27/2021)
API Revisions - WSO2 API Manager Community Call (10/27/2021)API Revisions - WSO2 API Manager Community Call (10/27/2021)
API Revisions - WSO2 API Manager Community Call (10/27/2021)
 
[Open Source Summit 2019] Microservices with Ballerina
[Open Source Summit 2019] Microservices with Ballerina[Open Source Summit 2019] Microservices with Ballerina
[Open Source Summit 2019] Microservices with Ballerina
 
Consumer-driven contracts with Pact and PHP
Consumer-driven contracts with Pact and PHPConsumer-driven contracts with Pact and PHP
Consumer-driven contracts with Pact and PHP
 
20140515 BTUG.be - Integration with SAP 101
20140515 BTUG.be - Integration with SAP 10120140515 BTUG.be - Integration with SAP 101
20140515 BTUG.be - Integration with SAP 101
 
AppeX and JavaScript Support Enhancements in Cincom Smalltalk
AppeX and JavaScript Support Enhancements in Cincom SmalltalkAppeX and JavaScript Support Enhancements in Cincom Smalltalk
AppeX and JavaScript Support Enhancements in Cincom Smalltalk
 
Presentation at the 2016 Linux Foundation Collab Summit
Presentation at the 2016 Linux Foundation Collab SummitPresentation at the 2016 Linux Foundation Collab Summit
Presentation at the 2016 Linux Foundation Collab Summit
 
Microservices: Consumer Driven Contracts in Practice
Microservices: Consumer Driven Contracts in PracticeMicroservices: Consumer Driven Contracts in Practice
Microservices: Consumer Driven Contracts in Practice
 
Vizag mulesoft-meetup-6-anypoint-datagraph--v2
Vizag mulesoft-meetup-6-anypoint-datagraph--v2Vizag mulesoft-meetup-6-anypoint-datagraph--v2
Vizag mulesoft-meetup-6-anypoint-datagraph--v2
 
News about UI5 that you absolutely have to know (UI5con 2017)
News about UI5 that you absolutely have to know (UI5con 2017)News about UI5 that you absolutely have to know (UI5con 2017)
News about UI5 that you absolutely have to know (UI5con 2017)
 

Similar a Chernivtsi Magento Meetup&Contribution day. Miniailo.I.

API design best practices
API design best practicesAPI design best practices
API design best practicesIgor Miniailo
 
Chernivtsi Magento Meetup&Contribution day. Naida V.
Chernivtsi Magento Meetup&Contribution day. Naida V.Chernivtsi Magento Meetup&Contribution day. Naida V.
Chernivtsi Magento Meetup&Contribution day. Naida V.Elogic Magento Development
 
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
 
Backward Compatibility Developer's Guide Webinar
Backward Compatibility Developer's Guide WebinarBackward Compatibility Developer's Guide Webinar
Backward Compatibility Developer's Guide WebinarIgor Miniailo
 
Automated tests in Magento
Automated tests in MagentoAutomated tests in Magento
Automated tests in MagentoYevhen Sentiabov
 
Backwards Compatibility Developers Guide. #MM17NL
Backwards Compatibility Developers Guide. #MM17NLBackwards Compatibility Developers Guide. #MM17NL
Backwards Compatibility Developers Guide. #MM17NLIgor Miniailo
 
Mli 2017 technical backward compatibility
Mli 2017 technical backward compatibilityMli 2017 technical backward compatibility
Mli 2017 technical backward compatibilityHanoi MagentoMeetup
 
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
 
Testing in Magento 2
Testing in Magento 2 Testing in Magento 2
Testing in Magento 2 Igor Miniailo
 
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
 
Meaningful UI Test Automation
Meaningful UI Test AutomationMeaningful UI Test Automation
Meaningful UI Test AutomationRahul Verma
 
Magento 2 Best Practice MLUK17
Magento 2 Best Practice MLUK17Magento 2 Best Practice MLUK17
Magento 2 Best Practice MLUK17Brent W Peterson
 
API First - Best Practices for consistent API management
API First - Best Practices for consistent API managementAPI First - Best Practices for consistent API management
API First - Best Practices for consistent API managementSven Bernhardt
 
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
 
API Contract as Code: Rapid Development with OpenAPI
API Contract as Code: Rapid Development with OpenAPIAPI Contract as Code: Rapid Development with OpenAPI
API Contract as Code: Rapid Development with OpenAPISmartBear
 
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
 
Consumer Driven Contracts and Your Microservice Architecture
Consumer Driven Contracts and Your Microservice ArchitectureConsumer Driven Contracts and Your Microservice Architecture
Consumer Driven Contracts and Your Microservice ArchitectureVMware Tanzu
 
Language Translations for Custom Scoped Applications in ServiceNow
Language Translations for Custom Scoped Applications in ServiceNowLanguage Translations for Custom Scoped Applications in ServiceNow
Language Translations for Custom Scoped Applications in ServiceNowLon Landry
 
Building Composite Application for Lotus Notes 8
Building Composite Application for Lotus Notes 8Building Composite Application for Lotus Notes 8
Building Composite Application for Lotus Notes 8dominion
 

Similar a Chernivtsi Magento Meetup&Contribution day. Miniailo.I. (20)

API design best practices
API design best practicesAPI design best practices
API design best practices
 
Chernivtsi Magento Meetup&Contribution day. Naida V.
Chernivtsi Magento Meetup&Contribution day. Naida V.Chernivtsi Magento Meetup&Contribution day. Naida V.
Chernivtsi Magento Meetup&Contribution day. Naida V.
 
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
 
Backward Compatibility Developer's Guide Webinar
Backward Compatibility Developer's Guide WebinarBackward Compatibility Developer's Guide Webinar
Backward Compatibility Developer's Guide Webinar
 
Automated tests in Magento
Automated tests in MagentoAutomated tests in Magento
Automated tests in Magento
 
Backwards Compatibility Developers Guide. #MM17NL
Backwards Compatibility Developers Guide. #MM17NLBackwards Compatibility Developers Guide. #MM17NL
Backwards Compatibility Developers Guide. #MM17NL
 
Mli 2017 technical backward compatibility
Mli 2017 technical backward compatibilityMli 2017 technical backward compatibility
Mli 2017 technical backward compatibility
 
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
 
Testing in Magento 2
Testing in Magento 2 Testing in Magento 2
Testing in Magento 2
 
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
 
Meaningful UI Test Automation
Meaningful UI Test AutomationMeaningful UI Test Automation
Meaningful UI Test Automation
 
Magento 2 Best Practice MLUK17
Magento 2 Best Practice MLUK17Magento 2 Best Practice MLUK17
Magento 2 Best Practice MLUK17
 
API First - Best Practices for consistent API management
API First - Best Practices for consistent API managementAPI First - Best Practices for consistent API management
API First - Best Practices for consistent API management
 
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
 
API Contract as Code: Rapid Development with OpenAPI
API Contract as Code: Rapid Development with OpenAPIAPI Contract as Code: Rapid Development with OpenAPI
API Contract as Code: Rapid Development with OpenAPI
 
Real Time Project
Real Time ProjectReal Time Project
Real Time Project
 
Volodymyr Kublytskyi - Develop Product, Design Platform
Volodymyr Kublytskyi - Develop Product, Design PlatformVolodymyr Kublytskyi - Develop Product, Design Platform
Volodymyr Kublytskyi - Develop Product, Design Platform
 
Consumer Driven Contracts and Your Microservice Architecture
Consumer Driven Contracts and Your Microservice ArchitectureConsumer Driven Contracts and Your Microservice Architecture
Consumer Driven Contracts and Your Microservice Architecture
 
Language Translations for Custom Scoped Applications in ServiceNow
Language Translations for Custom Scoped Applications in ServiceNowLanguage Translations for Custom Scoped Applications in ServiceNow
Language Translations for Custom Scoped Applications in ServiceNow
 
Building Composite Application for Lotus Notes 8
Building Composite Application for Lotus Notes 8Building Composite Application for Lotus Notes 8
Building Composite Application for Lotus Notes 8
 

Más de Elogic Magento Development

Миграция кода с Magento 1 на Magento 2
Миграция кода с Magento 1 на Magento 2Миграция кода с Magento 1 на Magento 2
Миграция кода с Magento 1 на Magento 2Elogic Magento Development
 
CQRS and Event-Sourcing in Magento2 by examples of MSI
CQRS and Event-Sourcing in Magento2 by examples of MSICQRS and Event-Sourcing in Magento2 by examples of MSI
CQRS and Event-Sourcing in Magento2 by examples of MSIElogic Magento Development
 
Chernivtsi Magento Meetup&Contribution day. V. Kublytskyi
 Chernivtsi Magento Meetup&Contribution day. V. Kublytskyi Chernivtsi Magento Meetup&Contribution day. V. Kublytskyi
Chernivtsi Magento Meetup&Contribution day. V. KublytskyiElogic Magento Development
 
12 Ways to Improve Magento 2 Security and Performance
12 Ways to Improve Magento 2 Security and Performance12 Ways to Improve Magento 2 Security and Performance
12 Ways to Improve Magento 2 Security and PerformanceElogic Magento Development
 
Как благодаря композеру использовать сторонние компоненты в Magento 2
Как благодаря композеру использовать сторонние компоненты в Magento 2Как благодаря композеру использовать сторонние компоненты в Magento 2
Как благодаря композеру использовать сторонние компоненты в Magento 2Elogic Magento Development
 
Як перехід на Magento допоміг нам стати лідером
Як перехід на Magento допоміг нам стати лідеромЯк перехід на Magento допоміг нам стати лідером
Як перехід на Magento допоміг нам стати лідеромElogic Magento Development
 
Как переписать модуль с Magento 1 на Magento 2
Как переписать модуль с Magento 1 на Magento 2Как переписать модуль с Magento 1 на Magento 2
Как переписать модуль с Magento 1 на Magento 2Elogic Magento Development
 

Más de Elogic Magento Development (15)

Magento Technical guidelines
Magento Technical guidelinesMagento Technical guidelines
Magento Technical guidelines
 
Миграция кода с Magento 1 на Magento 2
Миграция кода с Magento 1 на Magento 2Миграция кода с Magento 1 на Magento 2
Миграция кода с Magento 1 на Magento 2
 
Introduction to Magento Community
Introduction to Magento Community Introduction to Magento Community
Introduction to Magento Community
 
CQRS and Event-Sourcing in Magento2 by examples of MSI
CQRS and Event-Sourcing in Magento2 by examples of MSICQRS and Event-Sourcing in Magento2 by examples of MSI
CQRS and Event-Sourcing in Magento2 by examples of MSI
 
Chernivtsi Magento Meetup&Contribution day. V. Kublytskyi
 Chernivtsi Magento Meetup&Contribution day. V. Kublytskyi Chernivtsi Magento Meetup&Contribution day. V. Kublytskyi
Chernivtsi Magento Meetup&Contribution day. V. Kublytskyi
 
The process of a Lean Magento development
The process of a Lean Magento developmentThe process of a Lean Magento development
The process of a Lean Magento development
 
12 Ways to Improve Magento 2 Security and Performance
12 Ways to Improve Magento 2 Security and Performance12 Ways to Improve Magento 2 Security and Performance
12 Ways to Improve Magento 2 Security and Performance
 
MMnl Pavlo Okhrem
MMnl Pavlo Okhrem MMnl Pavlo Okhrem
MMnl Pavlo Okhrem
 
LIOF 2016
LIOF 2016LIOF 2016
LIOF 2016
 
Payment integration patterns в Magento2
Payment integration patterns в Magento2Payment integration patterns в Magento2
Payment integration patterns в Magento2
 
Как благодаря композеру использовать сторонние компоненты в Magento 2
Как благодаря композеру использовать сторонние компоненты в Magento 2Как благодаря композеру использовать сторонние компоненты в Magento 2
Как благодаря композеру использовать сторонние компоненты в Magento 2
 
Magento 2 - the future of eCommerce
Magento 2 - the future of eCommerceMagento 2 - the future of eCommerce
Magento 2 - the future of eCommerce
 
RequireJS і Magento 2
RequireJS і Magento 2RequireJS і Magento 2
RequireJS і Magento 2
 
Як перехід на Magento допоміг нам стати лідером
Як перехід на Magento допоміг нам стати лідеромЯк перехід на Magento допоміг нам стати лідером
Як перехід на Magento допоміг нам стати лідером
 
Как переписать модуль с Magento 1 на Magento 2
Как переписать модуль с Magento 1 на Magento 2Как переписать модуль с Magento 1 на Magento 2
Как переписать модуль с Magento 1 на Magento 2
 

Último

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Christo Ananth
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 

Último (20)

(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 

Chernivtsi Magento Meetup&Contribution day. Miniailo.I.

  • 1. © 2017 Magento, Inc. Page | 1 ‘17 API Design Best practices Igor Miniailo Magento Architect
  • 2. © 2017 Magento, Inc. Page | 2 ‘17
  • 3. © 2017 Magento, Inc. Page | 3 ‘17
  • 4. © 2017 Magento, Inc. Page | 4 ‘17 Why is API so crucial?
  • 5. © 2017 Magento, Inc. Page | 5 ‘17
  • 6. © 2017 Magento, Inc. Page | 6 ‘17
  • 7. © 2017 Magento, Inc. Page | 7 ‘17
  • 8. © 2017 Magento, Inc. Page | 8 ‘17 Semantic Versioning Version numbers are in the format MAJOR.MINOR.PATCH, where: – MAJOR indicates incompatible API changes – MINOR indicates backward-compatible functionality has been added – PATCH indicates backward-compatible bug fixes
  • 9. © 2017 Magento, Inc. Page | 9 ‘17 The backward compatibility policy applies to PHP code annotated with @api
  • 10. © 2017 Magento, Inc. Page | 10 ‘17 Public and Private code
  • 11. © 2017 Magento, Inc. Page | 11 ‘17 Public vs Private code Private code is not supposed to be used by third party modules, so, in most cases, its modifications will only trigger PATCH version bumps. Changes in public code always trigger MINOR or MAJOR version bumps.
  • 12. © 2017 Magento, Inc. Page | 12 ‘17 What examples of Public code Magento has? • PHP Interface (marked with @api) • PHP Class (marked with @api) • Javascript Interface (marked with @api) • Javascript Class (marked with @api) • Virtual Type (marked with @api) • URL paths • Console commands and their arguments • Less Variables & Mixins • Message queue topics and their data types • UI component declarations • Layout handles declared by modules • Events triggered by component (both static dynamic) • Schema of configuration types introduced by module • Structure of System Configuration fields used by module
  • 13. © 2017 Magento, Inc. Page | 13 ‘17 API vs SPI (Extension Points) A PHP Interface in Magento can be used several ways by the core product and extension developers. • As an API. is a set of interfaces and their implementations that a module provides to other modules • As a Service Provider Interface (SPI). is a set of interfaces that a module uses internally and allows their implementation by other modules. • As both. APIs and SPIs are not mutually exclusive.
  • 14. © 2017 Magento, Inc. Page | 14 ‘17 After the code is released, both API and SPI can be evolved in a backwards-compatible way. But both have their specific limitations.
  • 15. © 2017 Magento, Inc. Page | 15 ‘17
  • 16. © 2017 Magento, Inc. Page | 16 ‘17
  • 17. © 2017 Magento, Inc. Page | 17 ‘17
  • 18. © 2017 Magento, Inc. Page | 18 ‘17
  • 19. © 2017 Magento, Inc. Page | 19 ‘17
  • 20. © 2017 Magento, Inc. Page | 20 ‘17 We do not distinguish them separately. SPIs are annotated the same as APIs.
  • 21. © 2017 Magento, Inc. Page | 21 ‘17 Who decides whether interface/class belong to API or SPI? YOU
  • 22. © 2017 Magento, Inc. Page | 22 ‘17 Dependency Rules API If a module uses (calls) an API, it should be dependent on the MAJOR version. API dependency example { ... "require": { "magento/module-customer": "~100.0", // (>=100.0 <101.0.0) }, ... }
  • 23. © 2017 Magento, Inc. Page | 23 ‘17 Dependency Rules SPI If a module implements an API/SPI, it should be dependent on the MAJOR+MINOR version. SPI dependency example { ... "require": { "magento/module-customer": "~100.0.0", // (>=100.0.0 <100.1.0) }, ... }
  • 24. © 2017 Magento, Inc. Page | 24 ‘17 http://devdocs.magento.com/guides/v2.1/release-notes/backward- incompatible-changes-2.1.html
  • 25. © 2017 Magento, Inc. Page | 25 ‘17 Prohibited Code Changes
  • 26. © 2017 Magento, Inc. Page | 26 ‘17 • Interface/class removal • Public & protected method removal • Introduction of a method to a class or interface PHP - Prohibited Code Changes
  • 27. © 2017 Magento, Inc. Page | 27 ‘17 MagentoCatalogApiCategoryRepositoryInterface
  • 28. © 2017 Magento, Inc. Page | 28 ‘17 MagentoCatalogApiCategoryListInterface
  • 29. © 2017 Magento, Inc. Page | 29 ‘17 PHP - Prohibited Code Changes • Static function removal • Parameter addition in public methods • Parameter addition in protected methods
  • 30. © 2017 Magento, Inc. Page | 30 ‘17
  • 31. © 2017 Magento, Inc. Page | 31 ‘17 PHP - Prohibited Code Changes • Method argument type modification • Modification of types of thrown exceptions (unless a new exception is a subtype of the old one) • Constructor modification
  • 32. © 2017 Magento, Inc. Page | 32 ‘17 class ExistingClass { /** * @var NewDependencyInterface $newDependency */ private $newDependency; public function __construct( OldDependencyIntreface $oldDependency, $oldRequiredConstructorParameter, $oldOptinalConstructorParameter = null, NewDependencyInterface $newDependency = null ) { ... $this>newDependency = $newDependency ?: MagentoFrameworkAppObjectManager::getInstance() ->get(NewDependencyInterface::class); ... } public function existingFunction() { // Existing functionality ... // Use $this->newDependency wherever the new dependency is needed ... } }
  • 33. © 2017 Magento, Inc. Page | 33 ‘17 PHP - Prohibited Code Changes • Modifying the default values of optional arguments in public and protected methods • Removing or renaming constants
  • 34. © 2017 Magento, Inc. Page | 34 ‘17 The main rule is that backwards compatibility is more important than niceness and effort of the implementation.
  • 35. © 2017 Magento, Inc. Page | 35 ‘17 Coupling Between Objects Reaches Its Limit with a New Dependency
  • 36. © 2017 Magento, Inc. Page | 36 ‘17 We MUST do continuous Refactoring! Backward Compatibility should not be an excuse for not doing refactoring!
  • 37. © 2017 Magento, Inc. Page | 37 ‘17 Backward Compatible Fix *it works (most of the time), but code quality is far from good enough
  • 38. © 2017 Magento, Inc. Page | 38 ‘17 Good object oriented programming in the service layer is basically functional programming: • constructor injection • immutable state • single responsibility principle • uniform interfaces • value objects passed across services Bringing these concepts to an extreme leads to single-method, immutable objects.
  • 39. © 2017 Magento, Inc. Page | 39 ‘17
  • 40. © 2017 Magento, Inc. Page | 40 ‘17 Ubiquitous language matters
  • 41. © 2017 Magento, Inc. Page | 41 ‘17 Why to use `execute` but not __invoke?
  • 42. © 2017 Magento, Inc. Page | 42 ‘17 Proposal to move towards Functional Objects
  • 43. © 2017 Magento, Inc. Page | 43 ‘17
  • 44. © 2017 Magento, Inc. Page | 44 ‘17 Pros The main reason for __invoke usage proposal was elimination of unneeded `execute` methods, which look a bit artificial and redundant here
  • 45. © 2017 Magento, Inc. Page | 45 ‘17 Cons No autocomplete in PHP Storm IDE accessing via $this
  • 46. © 2017 Magento, Inc. Page | 46 ‘17 Cons
  • 47. © 2017 Magento, Inc. Page | 47 ‘17 Cons Unit tests look frustrating and non intuitive
  • 48. © 2017 Magento, Inc. Page | 48 ‘17 Repositories In Magento 2 Repositories are considered as an implementation of Facade pattern which provides a simplified interface to a larger body of code responsible for Domain Entity management. The main intention is to make API more readable and reduce dependencies of business logic code on the inner workings of a module, since most code uses the facade, thus allowing more flexibility in developing the system.
  • 49. © 2017 Magento, Inc. Page | 49 ‘17 Repositories
  • 50. © 2017 Magento, Inc. Page | 50 ‘17
  • 51. © 2017 Magento, Inc. Page | 51 ‘17
  • 52. © 2017 Magento, Inc. Page | 52 ‘17 Good API design Don't make your client do anything you can do for them (this reduces the amount of boilerplate code your client will have)
  • 53. © 2017 Magento, Inc. Page | 53 ‘17
  • 54. © 2017 Magento, Inc. Page | 54 ‘17 Q & A @iminyaylo engcom@magento.com

Notas del editor

  1. We promise to be backward compatible for classes and methods annotated with @api within MINOR and PATCH updates to our components. As changes are introduced, we annotate methods with @deprecated. The methods are removed only with the next MAJOR component version. 
  2. Let’s recap what we had with Magento 1 – where everything is an extension points. All the protected mess and so on. We can’t make changes in contract – all changes suppose to extend existing contract.
  3. Tilde = Significant Release Operator