SlideShare a Scribd company logo
1 of 27
Download to read offline
# W PA Z
A D VA N C E D D E V E L O P E R M E E T U P
C H R I S
K L O S O W S K I
• Co-Lead Developer - Easy
Digital Downloads
• Founding Developer - Post
Promoter Pro
• Writing - KungFuGrep.com
• Home brewing
• Weird Dad
• @cklosowski (usually)
cklosowski
easydigitaldownloads.com | kungfugrep.com
T I M E I S M O N E Y
R A N G I N G F R O M $ 3 0 - $ 1 5 0 / H O U R , D E V T I M E I S N ’ T C H E A P
P R E V E N T I N E F F I C I E N C Y
T H R O U G H C O D E , W E C A N R E D U C E D E V T I M E
Reduce Code Complexity
Reuse Common Patterns
Refactor When Needed
C O N T E X T S W I T C H I N G I S B A D
H T T P : / / C H R I S K . I O / I / C O N T E X T
I N A P E R F E C T W O R L D …
C O N T E X T S W I T C H I N G I S A N E C E S S A RY E V I L
O P T I M I Z I N G W O R K F L O W
M A K I N G O U R A C T U A L “ F L O W ” T I M E M O R E E F F E C T I V E
R E D U C E C O M P L E X I T Y
T H E H A R D E R T O R E A D , T H E H A R D E R T O F I X
“Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it.”
-Brian Kernighan: Co-Developer of Unix
W H AT I S
C O M P L E X I T Y ?
• Difficult to read
• “Tricky” solutions
• Cyclomatic complexity
• Examples…?
• You Bet!
if ( true === $foo ) {
foreach ( $bar as $key => $baz ) {
$bar[ $key ] = strtolower( $baz );
}
}
H A R D T O R E A D
function execute_data_input( $data = array() ) {
// Hard to know what is needed to use `execute_data_input`
}
function execute_data_input( $arg1 = '', $arg2 = '', $arg3 = '' ) {
// Easily readable and defined argument sets
}
if($foo==true) {
foreach($bar as $key=>$baz)
$bar[$key]=strtolower($baz);
}
T R I C K Y C O D E
// Input
$utm = array(
'campaign' => 'PostPromoterPro',
'source' => 'twitter',
'medium' => 'social',
);
// Output is a string
utm_campaign=PostPromoterPro&utm_source=twitter&utm_medium=social
T R I C K Y C O D E
$utm_string .= implode( '&', array_map( function ( $v,
$k ) { return 'utm_' . $k . '=' . $v; }, $utm,
array_keys( $utm ) ) );
$first = true;
foreach ( $utm as $key => $value ) {
if ( ! $first ) {
$utm_string .= '&';
}
$utm_string .= 'utm_' . $key . '=' . $value;
$first = false;
}
R E U S E C O M M O N PAT T E R N S
C R E A T E C O M M O N PA T T E R N S A N D C O N V E N T I O N S
R E U S I N G Y O U R
PAT T E R N S
• Standardize
• Function Naming
• Variable Naming
• Directory Structure
• Abstract Data Models
• Build Base Classes
A L L A B O U T T H AT B A S ES L I D E S W I T H O U T A P U N A R E N ’ T R E A L LY S L I D E S …
‣ EDD_Recurring_Gateway
‣ EDD_Recurring_2Checkout extends EDD_Recurring_Gateway
‣ EDD_Recurring_Authorize extends EDD_Recurring_Gateway
‣ EDD_Recurring_Stripe extends EDD_Recurring_Gateway
‣ EDD_Recurring_PayPal extends EDD_Recurring_Gateway
‣ …
Object Inheritance - When you extend a class, the
subclass inherits all of the public and protected methods
from the parent class. Unless a class overrides those
methods, they will retain their original functionality.
B U I L D A T E M P L AT EH T T P S : / / G I T H U B . C O M / E A S Y D I G I TA L D O W N L O A D S / E D D - E X T E N S I O N - B O I L E R P L A T E
R E FA C T O R I N G I S O K
I T ’ S N O T A N E V I L W O R D A N D I S S O M E T I M E S N E C E S S A RY
Code refactoring is the process of restructuring existing code without
changing its external behavior.
W H Y R E FA C T O R
W E ’ R E N O T M A K I N G I T D O A N Y T H I N G D I F F E R E N T ! ?
B E N E F I T S O F
R E FA C T O R I N G
• Performance Improvements
• Improve Readability
• Reduce Complexity
• Seeing a Trend?
• Improve Matainability
• Adapt New Best Practices
• Foundation Improvements
• Improve Extensibility
S T O RY T I M E
A ‘ R E C U R R I N G PA Y M E N T S ’ C O M I N G O F A G E TA L E
August 30, 2012
First Commit, Ever
The Recurring Payments Story
January 23, 2015
Pressnomics 3
May 19, 2015
2.4 Development Starts
Jan 28, 2016
Preview Post
Feb 24, 2016
2.4 Goes Live
Jan 21, 2016
Live on AffiliateWP
The Recurring Payments Story
The Recurring Payments Story
• No “Backwards Compatibility”
• Introduced Gateway Base Class
• Introduced Classes for:
• Subscriber
• Subscription
• Emails
• Reminders
• Completely Refactored
• Raised the Price
Reduce, Reuse, Refactor

More Related Content

What's hot (20)

Sopa de letras numero 1 (1)
Sopa de letras numero 1 (1)Sopa de letras numero 1 (1)
Sopa de letras numero 1 (1)
 
Manual de uso de logotipo
Manual de uso de logotipoManual de uso de logotipo
Manual de uso de logotipo
 
Sopa --de--letras
Sopa --de--letrasSopa --de--letras
Sopa --de--letras
 
People + Machines
People + MachinesPeople + Machines
People + Machines
 
Sopa de letras tecnologia
Sopa de letras tecnologiaSopa de letras tecnologia
Sopa de letras tecnologia
 
Sopa --de--letras
Sopa --de--letrasSopa --de--letras
Sopa --de--letras
 
Sopa --de--letras (1)
Sopa --de--letras (1)Sopa --de--letras (1)
Sopa --de--letras (1)
 
Sopa --de--letras
Sopa --de--letrasSopa --de--letras
Sopa --de--letras
 
Corel draw x4
Corel draw x4Corel draw x4
Corel draw x4
 
Culon
CulonCulon
Culon
 
PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!
 
Hacking with Love
Hacking with LoveHacking with Love
Hacking with Love
 
Sopa de-letras-130327160455-phpapp01
Sopa de-letras-130327160455-phpapp01Sopa de-letras-130327160455-phpapp01
Sopa de-letras-130327160455-phpapp01
 
7
77
7
 
ashleyfarlow_springresume
ashleyfarlow_springresumeashleyfarlow_springresume
ashleyfarlow_springresume
 
Social media marketing basics An Overview by Mercy Rop
Social media marketing basics An Overview by Mercy RopSocial media marketing basics An Overview by Mercy Rop
Social media marketing basics An Overview by Mercy Rop
 
Group K Final Pitch at NAKFI2015
Group K Final Pitch at NAKFI2015Group K Final Pitch at NAKFI2015
Group K Final Pitch at NAKFI2015
 
SOPA DE LETRAS
SOPA DE LETRASSOPA DE LETRAS
SOPA DE LETRAS
 
Jaszmine extra vocabulario 4 2
Jaszmine extra vocabulario 4 2Jaszmine extra vocabulario 4 2
Jaszmine extra vocabulario 4 2
 
#Productivity - {S:01 Ep:02}
#Productivity - {S:01 Ep:02}#Productivity - {S:01 Ep:02}
#Productivity - {S:01 Ep:02}
 

Viewers also liked

Novafast SE Asia - Products
Novafast SE Asia - ProductsNovafast SE Asia - Products
Novafast SE Asia - ProductsKing K Tan
 
Online Reputatie Management - Invisible Puppy
Online Reputatie Management - Invisible PuppyOnline Reputatie Management - Invisible Puppy
Online Reputatie Management - Invisible PuppyDries De Kimpe
 
Työterveys ja -turvallisuus uuden ISO 45001 -standardin valossa, Inspectan Se...
Työterveys ja -turvallisuus uuden ISO 45001 -standardin valossa, Inspectan Se...Työterveys ja -turvallisuus uuden ISO 45001 -standardin valossa, Inspectan Se...
Työterveys ja -turvallisuus uuden ISO 45001 -standardin valossa, Inspectan Se...Kiwa Inspecta Suomi
 
ISO 45001 and Organisations as Complex Adaptive Systems
ISO 45001 and Organisations as Complex Adaptive SystemsISO 45001 and Organisations as Complex Adaptive Systems
ISO 45001 and Organisations as Complex Adaptive SystemsSAMTRAC International
 
How Color Affect communication
How Color Affect communicationHow Color Affect communication
How Color Affect communicationmahade Ahmed
 

Viewers also liked (9)

Balvant zala CV
Balvant zala CVBalvant zala CV
Balvant zala CV
 
HIDRAULICA.pdf
HIDRAULICA.pdfHIDRAULICA.pdf
HIDRAULICA.pdf
 
Novafast SE Asia - Products
Novafast SE Asia - ProductsNovafast SE Asia - Products
Novafast SE Asia - Products
 
Kevin furniss
Kevin furnissKevin furniss
Kevin furniss
 
Online Reputatie Management - Invisible Puppy
Online Reputatie Management - Invisible PuppyOnline Reputatie Management - Invisible Puppy
Online Reputatie Management - Invisible Puppy
 
Työterveys ja -turvallisuus uuden ISO 45001 -standardin valossa, Inspectan Se...
Työterveys ja -turvallisuus uuden ISO 45001 -standardin valossa, Inspectan Se...Työterveys ja -turvallisuus uuden ISO 45001 -standardin valossa, Inspectan Se...
Työterveys ja -turvallisuus uuden ISO 45001 -standardin valossa, Inspectan Se...
 
ISO 45001 and Organisations as Complex Adaptive Systems
ISO 45001 and Organisations as Complex Adaptive SystemsISO 45001 and Organisations as Complex Adaptive Systems
ISO 45001 and Organisations as Complex Adaptive Systems
 
How Color Affect communication
How Color Affect communicationHow Color Affect communication
How Color Affect communication
 
El GPS
El GPSEl GPS
El GPS
 

Similar to Reduce, Reuse, Refactor

From Content Strategy to Drupal Site Building - Connecting the dots
From Content Strategy to Drupal Site Building - Connecting the dotsFrom Content Strategy to Drupal Site Building - Connecting the dots
From Content Strategy to Drupal Site Building - Connecting the dotsRonald Ashri
 
From Content Strategy to Drupal Site Building - Connecting the Dots
From Content Strategy to Drupal Site Building - Connecting the DotsFrom Content Strategy to Drupal Site Building - Connecting the Dots
From Content Strategy to Drupal Site Building - Connecting the DotsRonald Ashri
 
Data Modelling at Scale
Data Modelling at ScaleData Modelling at Scale
Data Modelling at ScaleDavid Simons
 
Strangler Pattern in practice @PHPers Day 2019
Strangler Pattern in practice @PHPers Day 2019Strangler Pattern in practice @PHPers Day 2019
Strangler Pattern in practice @PHPers Day 2019Michał Kurzeja
 
Switching horses midstream - From Waterfall to Agile
Switching horses midstream - From Waterfall to AgileSwitching horses midstream - From Waterfall to Agile
Switching horses midstream - From Waterfall to AgileDoc Norton
 
Choosing the Right Database
Choosing the Right DatabaseChoosing the Right Database
Choosing the Right DatabaseDavid Simons
 
Helping Data Teams with Puppet / Puppet Camp London - Apr 13, 2015
Helping Data Teams with Puppet / Puppet Camp London - Apr 13, 2015Helping Data Teams with Puppet / Puppet Camp London - Apr 13, 2015
Helping Data Teams with Puppet / Puppet Camp London - Apr 13, 2015Sergii Khomenko
 
Puppet Camp London 2015 - Helping Data Teams with Puppet
Puppet Camp London 2015 - Helping Data Teams with PuppetPuppet Camp London 2015 - Helping Data Teams with Puppet
Puppet Camp London 2015 - Helping Data Teams with PuppetPuppet
 
High quality Front-End
High quality Front-EndHigh quality Front-End
High quality Front-EndDavid Simons
 
ATDD BY Example With Cucumber
ATDD BY Example With CucumberATDD BY Example With Cucumber
ATDD BY Example With CucumberDoug Morgan
 
From the right process to a solid cultural change
From the right process to a solid cultural changeFrom the right process to a solid cultural change
From the right process to a solid cultural changeFrancesco Zaia
 
SharePoint Saturday Redmond - Building solutions with the future in mind
SharePoint Saturday Redmond - Building solutions with the future in mindSharePoint Saturday Redmond - Building solutions with the future in mind
SharePoint Saturday Redmond - Building solutions with the future in mindChris Johnson
 
The Expanding Boundaries of CSS
The Expanding Boundaries of CSSThe Expanding Boundaries of CSS
The Expanding Boundaries of CSSchriseppstein
 
Canary Deployments on Amazon EKS with Istio - SRV305 - Chicago AWS Summit
Canary Deployments on Amazon EKS with Istio - SRV305 - Chicago AWS SummitCanary Deployments on Amazon EKS with Istio - SRV305 - Chicago AWS Summit
Canary Deployments on Amazon EKS with Istio - SRV305 - Chicago AWS SummitAmazon Web Services
 
Thomas Roth-Berghofer (University of West London) – Artificial Intelligence -...
Thomas Roth-Berghofer (University of West London) – Artificial Intelligence -...Thomas Roth-Berghofer (University of West London) – Artificial Intelligence -...
Thomas Roth-Berghofer (University of West London) – Artificial Intelligence -...Techsylvania
 
Artificial Intelligence – Case-based reasoning for recommender systems – Invi...
Artificial Intelligence – Case-based reasoning for recommender systems – Invi...Artificial Intelligence – Case-based reasoning for recommender systems – Invi...
Artificial Intelligence – Case-based reasoning for recommender systems – Invi...Thomas Roth-Berghofer
 

Similar to Reduce, Reuse, Refactor (20)

From Content Strategy to Drupal Site Building - Connecting the dots
From Content Strategy to Drupal Site Building - Connecting the dotsFrom Content Strategy to Drupal Site Building - Connecting the dots
From Content Strategy to Drupal Site Building - Connecting the dots
 
From Content Strategy to Drupal Site Building - Connecting the Dots
From Content Strategy to Drupal Site Building - Connecting the DotsFrom Content Strategy to Drupal Site Building - Connecting the Dots
From Content Strategy to Drupal Site Building - Connecting the Dots
 
Data Modelling at Scale
Data Modelling at ScaleData Modelling at Scale
Data Modelling at Scale
 
Content First in Action
Content First in ActionContent First in Action
Content First in Action
 
Strangler Pattern in practice @PHPers Day 2019
Strangler Pattern in practice @PHPers Day 2019Strangler Pattern in practice @PHPers Day 2019
Strangler Pattern in practice @PHPers Day 2019
 
Switching horses midstream - From Waterfall to Agile
Switching horses midstream - From Waterfall to AgileSwitching horses midstream - From Waterfall to Agile
Switching horses midstream - From Waterfall to Agile
 
Choosing the Right Database
Choosing the Right DatabaseChoosing the Right Database
Choosing the Right Database
 
Helping Data Teams with Puppet / Puppet Camp London - Apr 13, 2015
Helping Data Teams with Puppet / Puppet Camp London - Apr 13, 2015Helping Data Teams with Puppet / Puppet Camp London - Apr 13, 2015
Helping Data Teams with Puppet / Puppet Camp London - Apr 13, 2015
 
Puppet Camp London 2015 - Helping Data Teams with Puppet
Puppet Camp London 2015 - Helping Data Teams with PuppetPuppet Camp London 2015 - Helping Data Teams with Puppet
Puppet Camp London 2015 - Helping Data Teams with Puppet
 
High quality Front-End
High quality Front-EndHigh quality Front-End
High quality Front-End
 
ATDD BY Example With Cucumber
ATDD BY Example With CucumberATDD BY Example With Cucumber
ATDD BY Example With Cucumber
 
From the right process to a solid cultural change
From the right process to a solid cultural changeFrom the right process to a solid cultural change
From the right process to a solid cultural change
 
Meteor WWNRW Intro
Meteor WWNRW IntroMeteor WWNRW Intro
Meteor WWNRW Intro
 
SharePoint Saturday Redmond - Building solutions with the future in mind
SharePoint Saturday Redmond - Building solutions with the future in mindSharePoint Saturday Redmond - Building solutions with the future in mind
SharePoint Saturday Redmond - Building solutions with the future in mind
 
Witchcraft
WitchcraftWitchcraft
Witchcraft
 
The Expanding Boundaries of CSS
The Expanding Boundaries of CSSThe Expanding Boundaries of CSS
The Expanding Boundaries of CSS
 
Canary Deployments on Amazon EKS with Istio - SRV305 - Chicago AWS Summit
Canary Deployments on Amazon EKS with Istio - SRV305 - Chicago AWS SummitCanary Deployments on Amazon EKS with Istio - SRV305 - Chicago AWS Summit
Canary Deployments on Amazon EKS with Istio - SRV305 - Chicago AWS Summit
 
Thomas Roth-Berghofer (University of West London) – Artificial Intelligence -...
Thomas Roth-Berghofer (University of West London) – Artificial Intelligence -...Thomas Roth-Berghofer (University of West London) – Artificial Intelligence -...
Thomas Roth-Berghofer (University of West London) – Artificial Intelligence -...
 
Artificial Intelligence – Case-based reasoning for recommender systems – Invi...
Artificial Intelligence – Case-based reasoning for recommender systems – Invi...Artificial Intelligence – Case-based reasoning for recommender systems – Invi...
Artificial Intelligence – Case-based reasoning for recommender systems – Invi...
 
New Android Languages
New Android LanguagesNew Android Languages
New Android Languages
 

Recently uploaded

Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 

Recently uploaded (20)

Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 

Reduce, Reuse, Refactor

  • 1. # W PA Z A D VA N C E D D E V E L O P E R M E E T U P
  • 2. C H R I S K L O S O W S K I • Co-Lead Developer - Easy Digital Downloads • Founding Developer - Post Promoter Pro • Writing - KungFuGrep.com • Home brewing • Weird Dad • @cklosowski (usually)
  • 4. T I M E I S M O N E Y R A N G I N G F R O M $ 3 0 - $ 1 5 0 / H O U R , D E V T I M E I S N ’ T C H E A P
  • 5. P R E V E N T I N E F F I C I E N C Y T H R O U G H C O D E , W E C A N R E D U C E D E V T I M E Reduce Code Complexity Reuse Common Patterns Refactor When Needed
  • 6.
  • 7.
  • 8. C O N T E X T S W I T C H I N G I S B A D H T T P : / / C H R I S K . I O / I / C O N T E X T
  • 9. I N A P E R F E C T W O R L D … C O N T E X T S W I T C H I N G I S A N E C E S S A RY E V I L
  • 10. O P T I M I Z I N G W O R K F L O W M A K I N G O U R A C T U A L “ F L O W ” T I M E M O R E E F F E C T I V E
  • 11. R E D U C E C O M P L E X I T Y T H E H A R D E R T O R E A D , T H E H A R D E R T O F I X “Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” -Brian Kernighan: Co-Developer of Unix
  • 12. W H AT I S C O M P L E X I T Y ? • Difficult to read • “Tricky” solutions • Cyclomatic complexity • Examples…? • You Bet!
  • 13. if ( true === $foo ) { foreach ( $bar as $key => $baz ) { $bar[ $key ] = strtolower( $baz ); } } H A R D T O R E A D function execute_data_input( $data = array() ) { // Hard to know what is needed to use `execute_data_input` } function execute_data_input( $arg1 = '', $arg2 = '', $arg3 = '' ) { // Easily readable and defined argument sets } if($foo==true) { foreach($bar as $key=>$baz) $bar[$key]=strtolower($baz); }
  • 14. T R I C K Y C O D E // Input $utm = array( 'campaign' => 'PostPromoterPro', 'source' => 'twitter', 'medium' => 'social', ); // Output is a string utm_campaign=PostPromoterPro&utm_source=twitter&utm_medium=social
  • 15. T R I C K Y C O D E $utm_string .= implode( '&', array_map( function ( $v, $k ) { return 'utm_' . $k . '=' . $v; }, $utm, array_keys( $utm ) ) ); $first = true; foreach ( $utm as $key => $value ) { if ( ! $first ) { $utm_string .= '&'; } $utm_string .= 'utm_' . $key . '=' . $value; $first = false; }
  • 16. R E U S E C O M M O N PAT T E R N S C R E A T E C O M M O N PA T T E R N S A N D C O N V E N T I O N S
  • 17. R E U S I N G Y O U R PAT T E R N S • Standardize • Function Naming • Variable Naming • Directory Structure • Abstract Data Models • Build Base Classes
  • 18. A L L A B O U T T H AT B A S ES L I D E S W I T H O U T A P U N A R E N ’ T R E A L LY S L I D E S … ‣ EDD_Recurring_Gateway ‣ EDD_Recurring_2Checkout extends EDD_Recurring_Gateway ‣ EDD_Recurring_Authorize extends EDD_Recurring_Gateway ‣ EDD_Recurring_Stripe extends EDD_Recurring_Gateway ‣ EDD_Recurring_PayPal extends EDD_Recurring_Gateway ‣ … Object Inheritance - When you extend a class, the subclass inherits all of the public and protected methods from the parent class. Unless a class overrides those methods, they will retain their original functionality.
  • 19. B U I L D A T E M P L AT EH T T P S : / / G I T H U B . C O M / E A S Y D I G I TA L D O W N L O A D S / E D D - E X T E N S I O N - B O I L E R P L A T E
  • 20. R E FA C T O R I N G I S O K I T ’ S N O T A N E V I L W O R D A N D I S S O M E T I M E S N E C E S S A RY Code refactoring is the process of restructuring existing code without changing its external behavior.
  • 21. W H Y R E FA C T O R W E ’ R E N O T M A K I N G I T D O A N Y T H I N G D I F F E R E N T ! ?
  • 22. B E N E F I T S O F R E FA C T O R I N G • Performance Improvements • Improve Readability • Reduce Complexity • Seeing a Trend? • Improve Matainability • Adapt New Best Practices • Foundation Improvements • Improve Extensibility
  • 23. S T O RY T I M E A ‘ R E C U R R I N G PA Y M E N T S ’ C O M I N G O F A G E TA L E
  • 24. August 30, 2012 First Commit, Ever The Recurring Payments Story January 23, 2015 Pressnomics 3 May 19, 2015 2.4 Development Starts Jan 28, 2016 Preview Post Feb 24, 2016 2.4 Goes Live Jan 21, 2016 Live on AffiliateWP
  • 26. The Recurring Payments Story • No “Backwards Compatibility” • Introduced Gateway Base Class • Introduced Classes for: • Subscriber • Subscription • Emails • Reminders • Completely Refactored • Raised the Price