SlideShare a Scribd company logo
1 of 25
Download to read offline
THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING)
#mm17it	|	Riccardo	Tempesta
The daily work of a [Magento 2] developer consists of two main job types
Debugging
existing features
Creating
new features
Your code
3rd party’s
(or core) code
A B
We will focus on this
Debugging
existing features
Creating
new features
Your code
3rd party’s
(or core) code
A B
THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING)
#mm17it	|	Riccardo	Tempesta
A SHORT HINT ON: CREATING FEATURES
You will need these thingies:
§ PHPStorm IDE
§ Vagrant (or Docker ?)
§ GIT
§ Magicento2
§ Pestle
§ MSP CodeMonkey
THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING)
#mm17it	|	Riccardo	Tempesta
A SHORT HINT ON: CREATING FEATURES
Pestle, Magicento 2 and MSP CodeMonkey because:
§ Magento 2 requires a lot of boilerplate code
§ A typo is always lurking somewhere
§ Your time is not free
§ Magento 2 is not always DRY compliant
THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING)
#mm17it	|	Riccardo	Tempesta
A SHORT HINT ON: CREATING FEATURES
Example of code complexity: Magento 1 vs. Magento 2
Magento 1 – DB Models:
§ Model
§ ResourceModel
§ Collection
§ Install / Upgrade scripts
§ config.xml
Magento 2 – DB Models:
§ Model
§ ResourceModel
§ Collection
§ Install / Upgrade scripts
§ Repository
§ RepositoryInterface
§ ManagementInterface
§ DataInterface
§ Dependency Injection
§ Getters / Setters in DataInterface
§ API Preferences
Total involved files: 4-5 Total involved files: 8-9
THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING)
#mm17it	|	Riccardo	Tempesta
A SHORT HINT ON: CREATING FEATURES
MSP CodeMonkey can create a whole PSR-2 compliant DB model source code with
API, Interfaces, getters and setters. Just typing:
~$ bin/magento codemonkey:crud My_Module MyModelName my_sql_table
Magicento 2 and Pestle can create controllers, modules, plugins, observers and lots
of other coding entities in few clicks.
Your client does not always understand how complex this job is!
So make it as simple as possible for you because you will not be paid for this!
REMEMBER
THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING)
#mm17it	|	Riccardo	Tempesta
DEBUGGING
Your code
3rd party’s
(or core) code
DEBUGGING & REVERSE ENGINEERING
are the actual 99% work of a developer
THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING)
#mm17it	|	Riccardo	Tempesta
DEBUGGING FEATURES
Common scenario when you’re debugging your code:
§ You do not know where the broken piece of code may be.
§ It is very hard to let the client understand that debugging is part
(actually: the most) of developing, so:
§ You probably do not have any of the project’s budget left;
§ Plus, you have a very short time to fix it!
THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING)
#mm17it	|	Riccardo	Tempesta
DEBUGGING FEATURES
Common scenario when you’re debugging 3rd party’s code:
§ You have no clue about the how the work’s engineered.
§ You still do not know where the broken piece of code is.
§ You hope the programmer who worked on that code before you did not
touch the core.
§ The programmer who created that feature is now probably on permanent
vacation and/or does not speak a single word of your language!
THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING)
#mm17it	|	Riccardo	Tempesta
HOPE IT’S NOT A
MESS OF
SPAGHETTI CODE
THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING)
#mm17it	|	Riccardo	Tempesta
“I’ve seen PHP code you people wouldn’t believe…”
DEBUGGING FEATURES
Debugging process can be tricky in Magento 2.
Magento 2 has lots of new ways to intercept and change the standard core behaviour...
(I mean without changing the core! Do not try this at home!)
THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING)
#mm17it	|	Riccardo	Tempesta
Magento 1 rewriting tools
§ Rewrites
§ Routes hijacking
§ Observers
§ Layout updates
Magento 2 rewriting tools
§ Stackable preferences
§ Routes hijacking
§ Observers
§ Layout updates
§ Stackable plugins (after, before, around)
§ Extension attributes
§ Modifiers pool
DEBUGGING FEATURES
FINDING THE PIECE OF CODE YOU
NEED CAN BE OFTEN CHALLENGING
AND TIME CONSUMING.
THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING)
#mm17it	|	Riccardo	Tempesta
DEBUGGING FEATURES
So the hard part is simply
FIND SOME PIECE OF CODE DOING SOMETHING SOMEHOW SOMEWHERE
and, once found
FIX SOMETHING BROKEN SOMEWHERE WITH
SOME THING YOU WILL DO SOMEHOW
As easy as pie… isn’t it?
THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING)
#mm17it	|	Riccardo	Tempesta
DEBUGGING FEATURES
§ PhpStorm as IDE
§ MSP DevTools
§ To find out where the code is
§ PHP Xdebug
§ To find out what’s wrong with the code
§ GIT bisect
§ To find out when you broke it
THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING)
#mm17it	|	Riccardo	Tempesta
DEBUGGING FEATURES: MSP DEVTOOLS
§ Magento 1 & Magento 2 support
§ Free github project
§ Chrome extension
§ Chrome inspector integration
§ PHPStorm integration
THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING)
#mm17it	|	Riccardo	Tempesta
DEBUGGING FEATURES
MSP DevTools allows to inspect:
THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING)
#mm17it	|	Riccardo	Tempesta
§ Blocks
§ Observers
§ Plugins
§ Preferences
§ Design
§ UI Components
§ SQL queries
§ Profiler results
§ ...
DEBUGGING FEATURES: PHP X-DEBUG
§ Suspend code execution
§ Inspect variables
§ Log results
§ Runtime variables value change
§ PHP Storm integrates it
§ You can do the same with “var_dump”, “print_r” and “echo”,
but everytime you do that, a programmer dies somewhere!
THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING)
#mm17it	|	Riccardo	Tempesta
DEBUGGING FEATURES: GIT BISECT
A typical customer’s bug report is like:
If you manage to understand what is actually broken you can use GIT bisect.
So you just need to know:
§ what the broken features is and
§ when it was working for the last time.
THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING)
#mm17it	|	Riccardo	Tempesta
“Yesterday all was working on the website, today nothing
works! Fix it!!11!1!!”
DEBUGGING FEATURES: GIT BISECT
THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING)
#mm17it	|	Riccardo	Tempesta
Works like this
THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING)
#mm17it	|	Riccardo	Tempesta
THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING)
#mm17it	|	Riccardo	Tempesta
THANK YOU!
KEEP CALM
AND
I WILL ANSWER YOUR QUESTIONS
The right tools for the right job (or: surviving Magento 2 coding)

More Related Content

Viewers also liked

System Administration: Migliorare le performance di Magento CE
System Administration: Migliorare le performance di Magento CESystem Administration: Migliorare le performance di Magento CE
System Administration: Migliorare le performance di Magento CEMageSpecialist
 
System Administration: migliorare le performance di Magento Community Edition
System Administration: migliorare le performance di Magento Community EditionSystem Administration: migliorare le performance di Magento Community Edition
System Administration: migliorare le performance di Magento Community EditionMageSpecialist
 
Networking ICT in salsa E-commerce
Networking ICT in salsa E-commerceNetworking ICT in salsa E-commerce
Networking ICT in salsa E-commerceMageSpecialist
 
Strumenti di automazione in Magento 2
Strumenti di automazione in Magento 2Strumenti di automazione in Magento 2
Strumenti di automazione in Magento 2MageSpecialist
 
MAGENTO 2: Routing e Controllers - Paolo Vecchiocattivi
MAGENTO 2: Routing e Controllers - Paolo VecchiocattiviMAGENTO 2: Routing e Controllers - Paolo Vecchiocattivi
MAGENTO 2: Routing e Controllers - Paolo VecchiocattiviMageSpecialist
 
Meet Magento - the open source that is changing the world of commerce
Meet Magento - the open source that is changing the world of commerceMeet Magento - the open source that is changing the world of commerce
Meet Magento - the open source that is changing the world of commerceKuba Zwolinski
 
E-commerce: perché sì, perché no - Competenze per un e-commerce di successo
E-commerce: perché sì, perché no - Competenze per un e-commerce di successoE-commerce: perché sì, perché no - Competenze per un e-commerce di successo
E-commerce: perché sì, perché no - Competenze per un e-commerce di successoMageSpecialist
 
Code Generation in Magento 2
Code Generation in Magento 2Code Generation in Magento 2
Code Generation in Magento 2Sergii Shymko
 
Magento 2 Changes Overview
Magento 2 Changes OverviewMagento 2 Changes Overview
Magento 2 Changes OverviewSergii Shymko
 
Microservices Using Docker Containers for Magento 2
Microservices Using Docker Containers for Magento 2Microservices Using Docker Containers for Magento 2
Microservices Using Docker Containers for Magento 2Schogini Systems Pvt Ltd
 
Ups and Downs of Real Projects Based on Magento 2
Ups and Downs of Real Projects Based on Magento 2Ups and Downs of Real Projects Based on Magento 2
Ups and Downs of Real Projects Based on Magento 2Max Pronko
 
The journey of mastering Magento 2 for Magento 1 developers
The journey of mastering Magento 2 for Magento 1 developersThe journey of mastering Magento 2 for Magento 1 developers
The journey of mastering Magento 2 for Magento 1 developersGabriel Guarino
 
Magento 2 Theme Trainning for Beginners | Magenest
Magento 2 Theme Trainning for Beginners | MagenestMagento 2 Theme Trainning for Beginners | Magenest
Magento 2 Theme Trainning for Beginners | MagenestMagenest
 
Methods and Best Practices for High Performance eCommerce
Methods and Best Practices for High Performance eCommerceMethods and Best Practices for High Performance eCommerce
Methods and Best Practices for High Performance eCommercedmitriysoroka
 
Magento 2 Performance: Every Second Counts
Magento 2 Performance: Every Second CountsMagento 2 Performance: Every Second Counts
Magento 2 Performance: Every Second CountsJoshua Warren
 
Magento 2 Development for PHP Developers
Magento 2 Development for PHP DevelopersMagento 2 Development for PHP Developers
Magento 2 Development for PHP DevelopersJoshua Warren
 
Magento 2 Dependency Injection, Interceptors, and You - php[world] 2015
Magento 2 Dependency Injection, Interceptors, and You - php[world] 2015Magento 2 Dependency Injection, Interceptors, and You - php[world] 2015
Magento 2 Dependency Injection, Interceptors, and You - php[world] 2015Joshua Warren
 
#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers
#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers
#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With ContainersHanoi MagentoMeetup
 

Viewers also liked (19)

System Administration: Migliorare le performance di Magento CE
System Administration: Migliorare le performance di Magento CESystem Administration: Migliorare le performance di Magento CE
System Administration: Migliorare le performance di Magento CE
 
Magento2 shell
Magento2 shellMagento2 shell
Magento2 shell
 
System Administration: migliorare le performance di Magento Community Edition
System Administration: migliorare le performance di Magento Community EditionSystem Administration: migliorare le performance di Magento Community Edition
System Administration: migliorare le performance di Magento Community Edition
 
Networking ICT in salsa E-commerce
Networking ICT in salsa E-commerceNetworking ICT in salsa E-commerce
Networking ICT in salsa E-commerce
 
Strumenti di automazione in Magento 2
Strumenti di automazione in Magento 2Strumenti di automazione in Magento 2
Strumenti di automazione in Magento 2
 
MAGENTO 2: Routing e Controllers - Paolo Vecchiocattivi
MAGENTO 2: Routing e Controllers - Paolo VecchiocattiviMAGENTO 2: Routing e Controllers - Paolo Vecchiocattivi
MAGENTO 2: Routing e Controllers - Paolo Vecchiocattivi
 
Meet Magento - the open source that is changing the world of commerce
Meet Magento - the open source that is changing the world of commerceMeet Magento - the open source that is changing the world of commerce
Meet Magento - the open source that is changing the world of commerce
 
E-commerce: perché sì, perché no - Competenze per un e-commerce di successo
E-commerce: perché sì, perché no - Competenze per un e-commerce di successoE-commerce: perché sì, perché no - Competenze per un e-commerce di successo
E-commerce: perché sì, perché no - Competenze per un e-commerce di successo
 
Code Generation in Magento 2
Code Generation in Magento 2Code Generation in Magento 2
Code Generation in Magento 2
 
Magento 2 Changes Overview
Magento 2 Changes OverviewMagento 2 Changes Overview
Magento 2 Changes Overview
 
Microservices Using Docker Containers for Magento 2
Microservices Using Docker Containers for Magento 2Microservices Using Docker Containers for Magento 2
Microservices Using Docker Containers for Magento 2
 
Ups and Downs of Real Projects Based on Magento 2
Ups and Downs of Real Projects Based on Magento 2Ups and Downs of Real Projects Based on Magento 2
Ups and Downs of Real Projects Based on Magento 2
 
The journey of mastering Magento 2 for Magento 1 developers
The journey of mastering Magento 2 for Magento 1 developersThe journey of mastering Magento 2 for Magento 1 developers
The journey of mastering Magento 2 for Magento 1 developers
 
Magento 2 Theme Trainning for Beginners | Magenest
Magento 2 Theme Trainning for Beginners | MagenestMagento 2 Theme Trainning for Beginners | Magenest
Magento 2 Theme Trainning for Beginners | Magenest
 
Methods and Best Practices for High Performance eCommerce
Methods and Best Practices for High Performance eCommerceMethods and Best Practices for High Performance eCommerce
Methods and Best Practices for High Performance eCommerce
 
Magento 2 Performance: Every Second Counts
Magento 2 Performance: Every Second CountsMagento 2 Performance: Every Second Counts
Magento 2 Performance: Every Second Counts
 
Magento 2 Development for PHP Developers
Magento 2 Development for PHP DevelopersMagento 2 Development for PHP Developers
Magento 2 Development for PHP Developers
 
Magento 2 Dependency Injection, Interceptors, and You - php[world] 2015
Magento 2 Dependency Injection, Interceptors, and You - php[world] 2015Magento 2 Dependency Injection, Interceptors, and You - php[world] 2015
Magento 2 Dependency Injection, Interceptors, and You - php[world] 2015
 
#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers
#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers
#3 Hanoi Magento Meetup - Part 2: Scalable Magento Development With Containers
 

Similar to The right tools for the right job (or: surviving Magento 2 coding)

Riccardo Tempesta - The right tools for the right job (or: surviving Magento ...
Riccardo Tempesta - The right tools for the right job (or: surviving Magento ...Riccardo Tempesta - The right tools for the right job (or: surviving Magento ...
Riccardo Tempesta - The right tools for the right job (or: surviving Magento ...Meet Magento Italy
 
Magento 2: New and Innovative? - php[world] 2015
Magento 2: New and Innovative? - php[world] 2015Magento 2: New and Innovative? - php[world] 2015
Magento 2: New and Innovative? - php[world] 2015David Alger
 
How to migrate from Magento 1 to Magento 2
How to migrate from Magento 1 to Magento 2How to migrate from Magento 1 to Magento 2
How to migrate from Magento 1 to Magento 2Matthias Glitzner-Zeis
 
[CB20] DeClang: Anti-hacking compiler by Mengyuan Wan
[CB20] DeClang: Anti-hacking compiler by Mengyuan Wan[CB20] DeClang: Anti-hacking compiler by Mengyuan Wan
[CB20] DeClang: Anti-hacking compiler by Mengyuan WanCODE BLUE
 
Consequences of using the Copy-Paste method in C++ programming and how to dea...
Consequences of using the Copy-Paste method in C++ programming and how to dea...Consequences of using the Copy-Paste method in C++ programming and how to dea...
Consequences of using the Copy-Paste method in C++ programming and how to dea...Andrey Karpov
 
Angular 2 : learn TypeScript already with Angular 1
Angular 2 : learn TypeScript already with Angular 1Angular 2 : learn TypeScript already with Angular 1
Angular 2 : learn TypeScript already with Angular 1David Amend
 
IDE and Toolset For Magento Development
IDE and Toolset For Magento DevelopmentIDE and Toolset For Magento Development
IDE and Toolset For Magento DevelopmentAbid Malik
 
Oh the compilers you'll build
Oh the compilers you'll buildOh the compilers you'll build
Oh the compilers you'll buildMark Stoodley
 
Make implementation of third party elements in magento 2 in 5-times easier
Make implementation of third party elements in magento 2 in 5-times easierMake implementation of third party elements in magento 2 in 5-times easier
Make implementation of third party elements in magento 2 in 5-times easierElena Kulbich
 
Migrating from Magento 1 to Magento 2 @ Magento Meetup Wien
Migrating from Magento 1 to Magento 2 @ Magento Meetup WienMigrating from Magento 1 to Magento 2 @ Magento Meetup Wien
Migrating from Magento 1 to Magento 2 @ Magento Meetup WienMatthias Glitzner-Zeis
 
Protractor: The Hacker way (NG-MY 2019)
Protractor: The Hacker way (NG-MY 2019)Protractor: The Hacker way (NG-MY 2019)
Protractor: The Hacker way (NG-MY 2019)Will Huang
 
Code Difference Visualization by a Call Tree
Code Difference Visualization by a Call TreeCode Difference Visualization by a Call Tree
Code Difference Visualization by a Call TreeKamiya Toshihiro
 
XSS Countermeasures in Grails
XSS Countermeasures in GrailsXSS Countermeasures in Grails
XSS Countermeasures in GrailsOSOCO
 
XSS Countermeasures in Grails
XSS Countermeasures in GrailsXSS Countermeasures in Grails
XSS Countermeasures in Grailstheratpack
 
Awesome Architectures in Magento 2.3
Awesome Architectures in Magento 2.3Awesome Architectures in Magento 2.3
Awesome Architectures in Magento 2.3Riccardo Tempesta
 
Symfony2 as an api
Symfony2 as an apiSymfony2 as an api
Symfony2 as an apiKifah Abbad
 

Similar to The right tools for the right job (or: surviving Magento 2 coding) (20)

Riccardo Tempesta - The right tools for the right job (or: surviving Magento ...
Riccardo Tempesta - The right tools for the right job (or: surviving Magento ...Riccardo Tempesta - The right tools for the right job (or: surviving Magento ...
Riccardo Tempesta - The right tools for the right job (or: surviving Magento ...
 
Magento 2: New and Innovative? - php[world] 2015
Magento 2: New and Innovative? - php[world] 2015Magento 2: New and Innovative? - php[world] 2015
Magento 2: New and Innovative? - php[world] 2015
 
How to migrate from Magento 1 to Magento 2
How to migrate from Magento 1 to Magento 2How to migrate from Magento 1 to Magento 2
How to migrate from Magento 1 to Magento 2
 
[CB20] DeClang: Anti-hacking compiler by Mengyuan Wan
[CB20] DeClang: Anti-hacking compiler by Mengyuan Wan[CB20] DeClang: Anti-hacking compiler by Mengyuan Wan
[CB20] DeClang: Anti-hacking compiler by Mengyuan Wan
 
Consequences of using the Copy-Paste method in C++ programming and how to dea...
Consequences of using the Copy-Paste method in C++ programming and how to dea...Consequences of using the Copy-Paste method in C++ programming and how to dea...
Consequences of using the Copy-Paste method in C++ programming and how to dea...
 
Rebuilding our Foundation
Rebuilding our FoundationRebuilding our Foundation
Rebuilding our Foundation
 
Angular 2 : learn TypeScript already with Angular 1
Angular 2 : learn TypeScript already with Angular 1Angular 2 : learn TypeScript already with Angular 1
Angular 2 : learn TypeScript already with Angular 1
 
IDE and Toolset For Magento Development
IDE and Toolset For Magento DevelopmentIDE and Toolset For Magento Development
IDE and Toolset For Magento Development
 
Oh the compilers you'll build
Oh the compilers you'll buildOh the compilers you'll build
Oh the compilers you'll build
 
Make implementation of third party elements in magento 2 in 5-times easier
Make implementation of third party elements in magento 2 in 5-times easierMake implementation of third party elements in magento 2 in 5-times easier
Make implementation of third party elements in magento 2 in 5-times easier
 
Migrating from Magento 1 to Magento 2 @ Magento Meetup Wien
Migrating from Magento 1 to Magento 2 @ Magento Meetup WienMigrating from Magento 1 to Magento 2 @ Magento Meetup Wien
Migrating from Magento 1 to Magento 2 @ Magento Meetup Wien
 
Protractor: The Hacker way (NG-MY 2019)
Protractor: The Hacker way (NG-MY 2019)Protractor: The Hacker way (NG-MY 2019)
Protractor: The Hacker way (NG-MY 2019)
 
Code Difference Visualization by a Call Tree
Code Difference Visualization by a Call TreeCode Difference Visualization by a Call Tree
Code Difference Visualization by a Call Tree
 
XSS Countermeasures in Grails
XSS Countermeasures in GrailsXSS Countermeasures in Grails
XSS Countermeasures in Grails
 
XSS Countermeasures in Grails
XSS Countermeasures in GrailsXSS Countermeasures in Grails
XSS Countermeasures in Grails
 
XSS Countermeasures in Grails
XSS Countermeasures in GrailsXSS Countermeasures in Grails
XSS Countermeasures in Grails
 
Magento 2 development
Magento 2 developmentMagento 2 development
Magento 2 development
 
Awesome Architectures in Magento 2.3
Awesome Architectures in Magento 2.3Awesome Architectures in Magento 2.3
Awesome Architectures in Magento 2.3
 
Symfony2 as an api
Symfony2 as an apiSymfony2 as an api
Symfony2 as an api
 
Compiler tricks
Compiler tricksCompiler tricks
Compiler tricks
 

Recently uploaded

PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 

Recently uploaded (20)

PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 

The right tools for the right job (or: surviving Magento 2 coding)

  • 1.
  • 2. THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING) #mm17it | Riccardo Tempesta The daily work of a [Magento 2] developer consists of two main job types Debugging existing features Creating new features Your code 3rd party’s (or core) code A B
  • 3. We will focus on this Debugging existing features Creating new features Your code 3rd party’s (or core) code A B THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING) #mm17it | Riccardo Tempesta
  • 4. A SHORT HINT ON: CREATING FEATURES You will need these thingies: § PHPStorm IDE § Vagrant (or Docker ?) § GIT § Magicento2 § Pestle § MSP CodeMonkey THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING) #mm17it | Riccardo Tempesta
  • 5. A SHORT HINT ON: CREATING FEATURES Pestle, Magicento 2 and MSP CodeMonkey because: § Magento 2 requires a lot of boilerplate code § A typo is always lurking somewhere § Your time is not free § Magento 2 is not always DRY compliant THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING) #mm17it | Riccardo Tempesta
  • 6. A SHORT HINT ON: CREATING FEATURES Example of code complexity: Magento 1 vs. Magento 2 Magento 1 – DB Models: § Model § ResourceModel § Collection § Install / Upgrade scripts § config.xml Magento 2 – DB Models: § Model § ResourceModel § Collection § Install / Upgrade scripts § Repository § RepositoryInterface § ManagementInterface § DataInterface § Dependency Injection § Getters / Setters in DataInterface § API Preferences Total involved files: 4-5 Total involved files: 8-9 THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING) #mm17it | Riccardo Tempesta
  • 7. A SHORT HINT ON: CREATING FEATURES MSP CodeMonkey can create a whole PSR-2 compliant DB model source code with API, Interfaces, getters and setters. Just typing: ~$ bin/magento codemonkey:crud My_Module MyModelName my_sql_table Magicento 2 and Pestle can create controllers, modules, plugins, observers and lots of other coding entities in few clicks. Your client does not always understand how complex this job is! So make it as simple as possible for you because you will not be paid for this! REMEMBER THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING) #mm17it | Riccardo Tempesta
  • 8. DEBUGGING Your code 3rd party’s (or core) code DEBUGGING & REVERSE ENGINEERING are the actual 99% work of a developer THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING) #mm17it | Riccardo Tempesta
  • 9. DEBUGGING FEATURES Common scenario when you’re debugging your code: § You do not know where the broken piece of code may be. § It is very hard to let the client understand that debugging is part (actually: the most) of developing, so: § You probably do not have any of the project’s budget left; § Plus, you have a very short time to fix it! THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING) #mm17it | Riccardo Tempesta
  • 10. DEBUGGING FEATURES Common scenario when you’re debugging 3rd party’s code: § You have no clue about the how the work’s engineered. § You still do not know where the broken piece of code is. § You hope the programmer who worked on that code before you did not touch the core. § The programmer who created that feature is now probably on permanent vacation and/or does not speak a single word of your language! THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING) #mm17it | Riccardo Tempesta
  • 11. HOPE IT’S NOT A MESS OF SPAGHETTI CODE THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING) #mm17it | Riccardo Tempesta “I’ve seen PHP code you people wouldn’t believe…”
  • 12. DEBUGGING FEATURES Debugging process can be tricky in Magento 2. Magento 2 has lots of new ways to intercept and change the standard core behaviour... (I mean without changing the core! Do not try this at home!) THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING) #mm17it | Riccardo Tempesta Magento 1 rewriting tools § Rewrites § Routes hijacking § Observers § Layout updates Magento 2 rewriting tools § Stackable preferences § Routes hijacking § Observers § Layout updates § Stackable plugins (after, before, around) § Extension attributes § Modifiers pool
  • 13. DEBUGGING FEATURES FINDING THE PIECE OF CODE YOU NEED CAN BE OFTEN CHALLENGING AND TIME CONSUMING. THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING) #mm17it | Riccardo Tempesta
  • 14. DEBUGGING FEATURES So the hard part is simply FIND SOME PIECE OF CODE DOING SOMETHING SOMEHOW SOMEWHERE and, once found FIX SOMETHING BROKEN SOMEWHERE WITH SOME THING YOU WILL DO SOMEHOW As easy as pie… isn’t it? THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING) #mm17it | Riccardo Tempesta
  • 15. DEBUGGING FEATURES § PhpStorm as IDE § MSP DevTools § To find out where the code is § PHP Xdebug § To find out what’s wrong with the code § GIT bisect § To find out when you broke it THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING) #mm17it | Riccardo Tempesta
  • 16. DEBUGGING FEATURES: MSP DEVTOOLS § Magento 1 & Magento 2 support § Free github project § Chrome extension § Chrome inspector integration § PHPStorm integration THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING) #mm17it | Riccardo Tempesta
  • 17. DEBUGGING FEATURES MSP DevTools allows to inspect: THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING) #mm17it | Riccardo Tempesta § Blocks § Observers § Plugins § Preferences § Design § UI Components § SQL queries § Profiler results § ...
  • 18. DEBUGGING FEATURES: PHP X-DEBUG § Suspend code execution § Inspect variables § Log results § Runtime variables value change § PHP Storm integrates it § You can do the same with “var_dump”, “print_r” and “echo”, but everytime you do that, a programmer dies somewhere! THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING) #mm17it | Riccardo Tempesta
  • 19.
  • 20. DEBUGGING FEATURES: GIT BISECT A typical customer’s bug report is like: If you manage to understand what is actually broken you can use GIT bisect. So you just need to know: § what the broken features is and § when it was working for the last time. THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING) #mm17it | Riccardo Tempesta “Yesterday all was working on the website, today nothing works! Fix it!!11!1!!”
  • 21. DEBUGGING FEATURES: GIT BISECT THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING) #mm17it | Riccardo Tempesta Works like this
  • 22.
  • 23. THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING) #mm17it | Riccardo Tempesta
  • 24. THE RIGHT TOOLS FOR THE RIGHT JOB (OR: SURVIVING MAGENTO 2 CODING) #mm17it | Riccardo Tempesta THANK YOU! KEEP CALM AND I WILL ANSWER YOUR QUESTIONS