SlideShare a Scribd company logo
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 CE
MageSpecialist
 
Magento2 shell
Magento2 shellMagento2 shell
Magento2 shell
MageSpecialist
 
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
MageSpecialist
 
Networking ICT in salsa E-commerce
Networking ICT in salsa E-commerceNetworking ICT in salsa E-commerce
Networking ICT in salsa E-commerce
MageSpecialist
 
Strumenti di automazione in Magento 2
Strumenti di automazione in Magento 2Strumenti di automazione in Magento 2
Strumenti di automazione in Magento 2
MageSpecialist
 
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
MageSpecialist
 
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
Kuba 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 successo
MageSpecialist
 
Code Generation in Magento 2
Code Generation in Magento 2Code Generation in Magento 2
Code Generation in Magento 2
Sergii Shymko
 
Magento 2 Changes Overview
Magento 2 Changes OverviewMagento 2 Changes Overview
Magento 2 Changes Overview
Sergii 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 2
Schogini 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 2
Max 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 developers
Gabriel 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 | Magenest
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
dmitriysoroka
 
Magento 2 Performance: Every Second Counts
Magento 2 Performance: Every Second CountsMagento 2 Performance: Every Second Counts
Magento 2 Performance: Every Second Counts
Joshua Warren
 
Magento 2 Development for PHP Developers
Magento 2 Development for PHP DevelopersMagento 2 Development for PHP Developers
Magento 2 Development for PHP Developers
Joshua 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] 2015
Joshua 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 Containers
Hanoi 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] 2015
David 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 2
Matthias 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 Wan
CODE 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
 
Rebuilding our Foundation
Rebuilding our FoundationRebuilding our Foundation
Rebuilding our Foundation
Jessica Mauerhan
 
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
David Amend
 
IDE and Toolset For Magento Development
IDE and Toolset For Magento DevelopmentIDE and Toolset For Magento Development
IDE and Toolset For Magento Development
Abid Malik
 
Oh the compilers you'll build
Oh the compilers you'll buildOh the compilers you'll build
Oh the compilers you'll build
Mark 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 easier
Elena 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 Wien
Matthias 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 Tree
Kamiya Toshihiro
 
XSS Countermeasures in Grails
XSS Countermeasures in GrailsXSS Countermeasures in Grails
XSS Countermeasures in Grails
OSOCO
 
XSS Countermeasures in Grails
XSS Countermeasures in GrailsXSS Countermeasures in Grails
XSS Countermeasures in Grails
Rafael Luque Leiva
 
XSS Countermeasures in Grails
XSS Countermeasures in GrailsXSS Countermeasures in Grails
XSS Countermeasures in Grails
theratpack
 
Magento 2 development
Magento 2 developmentMagento 2 development
Magento 2 development
Olivia Williams
 
Awesome Architectures in Magento 2.3
Awesome Architectures in Magento 2.3Awesome Architectures in Magento 2.3
Awesome Architectures in Magento 2.3
Riccardo Tempesta
 
Symfony2 as an api
Symfony2 as an apiSymfony2 as an api
Symfony2 as an api
Kifah Abbad
 
Compiler tricks
Compiler tricksCompiler tricks
Compiler tricks
John Lluch-Zorrilla
 

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

AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
lorraineandreiamcidl
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
Codeigniter VS Cakephp Which is Better for Web Development.pdf
Codeigniter VS Cakephp Which is Better for Web Development.pdfCodeigniter VS Cakephp Which is Better for Web Development.pdf
Codeigniter VS Cakephp Which is Better for Web Development.pdf
Semiosis Software Private Limited
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
pavan998932
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Preparing Non - Technical Founders for Engaging a Tech Agency
Preparing Non - Technical Founders for Engaging  a  Tech AgencyPreparing Non - Technical Founders for Engaging  a  Tech Agency
Preparing Non - Technical Founders for Engaging a Tech Agency
ISH Technologies
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
kalichargn70th171
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
Gerardo Pardo-Castellote
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 

Recently uploaded (20)

AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
Codeigniter VS Cakephp Which is Better for Web Development.pdf
Codeigniter VS Cakephp Which is Better for Web Development.pdfCodeigniter VS Cakephp Which is Better for Web Development.pdf
Codeigniter VS Cakephp Which is Better for Web Development.pdf
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Preparing Non - Technical Founders for Engaging a Tech Agency
Preparing Non - Technical Founders for Engaging  a  Tech AgencyPreparing Non - Technical Founders for Engaging  a  Tech Agency
Preparing Non - Technical Founders for Engaging a Tech Agency
 
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
Why Mobile App Regression Testing is Critical for Sustained Success_ A Detail...
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 

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