SlideShare a Scribd company logo
1
@jucycabrera
Does your code spark joy?
Refactoring techniques to make your life easier
2
Juciellen
Cabrera
@jucycabrera
Mother of a really smart boy
PHP and Elephpants
PHPWomen
Living in Ireland
Food lover
Meme specialist
Software Engineer at Smartbox Group
3
@jucycabrera
Why talk about Refactoring?
And then ...
4
@jucycabrera
A change made to the internal structure of
software to make it easier to understand and
cheaper to modify without changing its
observable behavior.
Refactoring (noun) It’s also a common error to see refactoring as something
to fix past mistakes or clean up ugly code.
5
@jucycabrera
The idea that building an application that
will not undergo any changes are untrue
most of the time.
As people change code to achieve short-term goals,
often without a full comprehension of the
architecture, the code loses its structure. Loss of
structure has a cumulative effect.
You will find yourself refactoring ugly code,
but good code also needs refactoring.
6
@jucycabrera
Self-testing code not only enables
refactoring - it also makes it much safer
to add new features, since any bugs
introduced with the new feature can be
quickly found and fixed.
First things first...
7
@jucycabrera
Bad
Smells
Smudge, originally known as Cascão, is
one of the main characters of Monica's
Gang. He never takes a bath, he hates
water and never, ever touches it.
8
@jucycabrera
Mysterious Name
When you can’t think of a good name for something, it’s
often a sign of a deeper issue.
9
@jucycabrera
Duplicated Code
Means that every time you read these copies, you need to
read them carefully to see if there’s any difference.
10
@jucycabrera
Long Function
The longer the function,
the more difficult is to understand.
Large Class
A class with too much code is a bad opportunity for
duplicated code and chaos.
11
@jucycabrera
Shotgun Surgery
When every time you make a change, you have to make a lot
of little edits to a lot of different classes.
12
@jucycabrera
Long Parameter List
Long parameter lists are often confusing.
Primitive Obsession
Primitive types, such as integers, floating pointing numbers
and strings, don’t represent a type of data we are dealing
with.
13
@jucycabrera
Speculative Generality
Things created before they are needed.
● Abstract class that isn’t doing much
● Unnecessary delegation
● Functions with unused parameters
14
@jucycabrera
Repeated Switches
It also applies to if statement.
When the same conditional switching logic appears in
different places and you add a clause, it is necessary to find
all switches and update them.
15
@jucycabrera
Message Chain
Long line of getThis().
16
@jucycabrera
Comments
When you feel the need to write a comment, first try to
refactor the code so that any comment becomes
unnecessary.
Polemic topic!
17
@jucycabrera
List of
Refactorings
18
@jucycabrera
Extract Function
If you have to spend effort looking at a block of code trying
to figure out what it’s doing then you should extract it into a
function.
Inline Function
Inverse of Extract Function, where a function has a body as
clear as the name.
19
@jucycabrera
Extract Class
When you see a class that is too big to easily understand,
you need to consider where it can be split.
Inline Class
When a class is no longer pulling its weight and shouldn’t be
around anymore.
20
@jucycabrera
Hide Delegate
Encapsulation means that modules need to know less about
other parts of the system.
Remove Middle Man
Opposite of Hide Delegate.
Law of Demeter.
21
@jucycabrera
Extract Variable
Add a name to an expression that is complex and hard to read.
Inline Variable
When the name doesn’t really communicate more than the
expression itself.
Named properties
PHP 8
22
@jucycabrera
Change Function Declaration | Rename Method
A good name allows you to understand what the function
does when you see it called.
Rename Variable
Naming things well is at the heart of a clear programming.
Rename Fields
Fields names are important especially when they are
widely used across an application.
23
@jucycabrera
Encapsulate Collection
Access to a collection variable may be encapsulated.
24
@jucycabrera
Introduce Parameters Object
Groups of data that are often together could be replaced by a data
structure.
Replace Primitive with Object
e.g. Phone number, money
Preserve Whole Object
Values from the same object passed as an argument can be replaced by
passing the whole object.
25
@jucycabrera
Substitute Algorithm
Replace the complicated logic with a simpler one by
decomposing the method, or creating a new algorithm or
even using a native function.
26
@jucycabrera
Move Function | Move Field
A nested function to a top level, or between classes.
Slide Statements
Code is easier to understand when things related to each
other appear together.
27
@jucycabrera
Split Loop
You ensure you only need to understand one thing a time.
Separate refactoring
from optimization.
$averageAge = 0;
$totalSalary = 0;
foreach ($people as $person) {
$averageAge += $person->page;
$totalSalary += $person->salary;
}
$averageAge = $averageAge / count($people);
$averageAge = 0;
$totalSalary = 0;
foreach ($people as $person) {
$averageAge += $person->page;
}
foreach ($people as $person) {
$totalSalary += $person->salary;
}
$averageAge = $averageAge / count($people);
28
@jucycabrera
Remove Dead Code
Commenting out dead code is a common habit.
Don’t be afraid to delete dead code. We have version
control.
Joelma: One of Brazil’s Queens
29
@jucycabrera
Decomposite Conditional
Apply “Extract Function” on the condition and each leg of
the conditional.
if ($date->before(SUMMER_START) || $date->after(SUMMER_END)) {
$charge = $quantity * $winterRate + $winterServiceCharge;
} else {
$charge = $quantity * $summerRate;
}
if (isSummer($date)) {
$charge = summerCharge($quantity);
} else {
$charge = winterCharge($quantity);
}
30
@jucycabrera
Replace Nested Conditional with Guard Clauses
By reversing the conditions for example.
function getPayAmount() {
if ($this->isDead) {
$result = $this->deadAmount();
} else {
if ($this->isSeparated) {
$result = $this->separatedAmount();
} else {
if ($this->isRetired) {
$result = $this->retiredAmount();
} else {
$result = $this->normalPayAmount();
}
}
}
return $result;
}
function getPayAmount() {
if ($this->isDead) {
return $this->deadAmount();
}
if ($this->isSeparated) {
return $this->separatedAmount();
}
if ($this->isRetired) {
return $this->retiredAmount();
}
return $this->normalPayAmount();
}
31
@jucycabrera
Replace Conditional with
Polymorphism
Create subclasses matching the branches of the
conditional.
abstract class Bird {
// ...
abstract function getSpeed();
// ...
}
class European extends Bird {
public function getSpeed() {
return $this->getBaseSpeed();
}
}
class African extends Bird {
public function getSpeed() {
return $this->getBaseSpeed() -
$this->getLoadFactor() *
$this->numberOfCoconuts;
}
}
class NorwegianBlue extends Bird {
public function getSpeed() {
return ($this->isNailed) ? 0 :
$this->getBaseSpeed($this->voltage);
}
}
// Somewhere in Client code.
$speed = $bird->getSpeed();
class Bird {
// ...
public function getSpeed() {
switch ($this->type) {
case EUROPEAN:
return $this->getBaseSpeed();
case AFRICAN:
return $this->getBaseSpeed() - $this->getLoadFactor() *
$this->numberOfCoconuts;
case NORWEGIAN_BLUE:
return ($this->isNailed) ? 0 :
$this->getBaseSpeed($this->voltage);
}
throw new Exception("Should be unreachable");
}
// ...
}
32
@jucycabrera
Introduce Special Case | Null Object
A class that provides special behavior for particular cases.
if ($customer === null) {
$plan = BillingPlan::basic();
} else {
$plan = $customer->getPlan();
}
class NullCustomer extends Customer {
public function isNull() {
return true;
}
public function getPlan() {
return new NullPlan();
}
// Some other NULL functionality.
}
// Replace null values with Null-object.
$customer = ($order->customer !== null) ?
$order->customer :
new NullCustomer;
// Use Null-object as if it's normal subclass.
$plan = $customer->getPlan();
33
@jucycabrera
Separate Query from Modifier
A function that returns a value should not have observable side effects.
The famous case of findAndDoSomethingElse.
34
@jucycabrera
Parameterize Function
Functions that have similar logic with different values can be removed by
using a single function with parameters.
35
@jucycabrera
Remove Flag Argument
Flag argument is used to indicate which logic the function should execute.
It’s clear to provide an explicit function for each task.
36
@jucycabrera
Replace Constructor with Factory Function
By creating a single point where the class is instantiated you avoid tight
coupling.
class Employee {
// ...
public function __construct($type)
{
$this->type = $type;
}
// ...
}
class Employee {
// ...
static public function
create($type) {
$employee = new Employee($type);
// do some heavy lifting.
return $employee;
}
// ...
}
37
@jucycabrera
Extract Super class
Pull Up Method
Pull Up Field
Push Down Method
Push Down Field
Dealing with Inheritance
38
@jucycabrera
The key to effective refactoring is
recognizing that you go faster
when you take tiny steps
Martin Fowler
39
@jucycabrera
Tips
Keep an eye on updates
PHP8 is live!
Tests first!
Create them if you don’t have any
Tiny steps
Don’t waste an opportunity
to improve code
Code review is a chance to
discuss changes
40
@jucycabrera
Find more
by Martin Fowler, with Kent Beck
2018 - 2nd edition
https://martinfowler.com/books/refactoring.html
Refactoring
Improving the Design of Existing Code
https://refactoring.guru
41
Thank you
Obrigada
@jucycabrera

More Related Content

PDF
Functional Effects - Part 2
PDF
Functional Effects - Part 1
PDF
Unison Language - Contact
PDF
Monad Fact #6
PDF
Jumping-with-java8
PDF
non-strict functions, bottom and scala by-name parameters
PDF
Applicative Functor - Part 2
PDF
Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ...
Functional Effects - Part 2
Functional Effects - Part 1
Unison Language - Contact
Monad Fact #6
Jumping-with-java8
non-strict functions, bottom and scala by-name parameters
Applicative Functor - Part 2
Refactoring: A First Example - Martin Fowler’s First Example of Refactoring, ...

What's hot (20)

PPTX
Programming Primer EncapsulationVB
PPTX
Clean Code: Chapter 3 Function
PPTX
Programming Primer Encapsulation CS
PPTX
Javascript Common Design Patterns
PDF
Utility Classes
PPTX
重構—改善既有程式的設計(chapter 9)
PPTX
Behavioral pattern 4
PDF
Powerful JavaScript Tips and Best Practices
PDF
Programming in Java: Control Flow
PDF
Effective Java with Groovy - How Language Influences Adoption of Good Practices
PDF
‘go-to’ general-purpose sequential collections - from Java To Scala
PDF
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 1
PDF
Functional Javascript
PDF
Monadic Java
PDF
Java Script Best Practices
PPTX
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
PPTX
重構—改善既有程式的設計(chapter 8)part 1
PPTX
Writer Monad for logging execution of functions
PPTX
重構—改善既有程式的設計(chapter 8)part 2
PDF
Kleisli Composition
Programming Primer EncapsulationVB
Clean Code: Chapter 3 Function
Programming Primer Encapsulation CS
Javascript Common Design Patterns
Utility Classes
重構—改善既有程式的設計(chapter 9)
Behavioral pattern 4
Powerful JavaScript Tips and Best Practices
Programming in Java: Control Flow
Effective Java with Groovy - How Language Influences Adoption of Good Practices
‘go-to’ general-purpose sequential collections - from Java To Scala
Scala 3 by Example - Algebraic Data Types for Domain Driven Design - Part 1
Functional Javascript
Monadic Java
Java Script Best Practices
Concurrency, Scalability & Fault-tolerance 2.0 with Akka Actors & STM
重構—改善既有程式的設計(chapter 8)part 1
Writer Monad for logging execution of functions
重構—改善既有程式的設計(chapter 8)part 2
Kleisli Composition
Ad

Similar to Does your code spark joy? Refactoring techniques to make your life easier. (20)

PPT
Design Patterns and Usage
PPTX
Presentacion clean code
 
PPTX
clean code book summary - uncle bob - English version
PDF
Breaking Dependencies Legacy Code - Cork Software Crafters - September 2019
PDF
Clean code
PDF
Responsible JavaScript
DOCX
New microsoft office word document (2)
PPT
Refactoring Tips by Martin Fowler
PPTX
Polymorphism in OPP, JAVA, Method overload.pptx
PDF
Jeremiah Caballero - Introduction of Clean Code
DOCX
Faculty of ScienceDepartment of ComputingFinal Examinati.docx
PDF
Java performance
DOCX
C questions
PDF
Professional JavaScript: AntiPatterns
PPT
2.overview of c++ ________lecture2
PPTX
2. Design patterns. part #2
PPTX
Encapsulation
PPTX
Javascript Design Patterns
PDF
10 PHP Design Patterns #burningkeyboards
PDF
PHP: 4 Design Patterns to Make Better Code
Design Patterns and Usage
Presentacion clean code
 
clean code book summary - uncle bob - English version
Breaking Dependencies Legacy Code - Cork Software Crafters - September 2019
Clean code
Responsible JavaScript
New microsoft office word document (2)
Refactoring Tips by Martin Fowler
Polymorphism in OPP, JAVA, Method overload.pptx
Jeremiah Caballero - Introduction of Clean Code
Faculty of ScienceDepartment of ComputingFinal Examinati.docx
Java performance
C questions
Professional JavaScript: AntiPatterns
2.overview of c++ ________lecture2
2. Design patterns. part #2
Encapsulation
Javascript Design Patterns
10 PHP Design Patterns #burningkeyboards
PHP: 4 Design Patterns to Make Better Code
Ad

More from Juciellen Cabrera (8)

PDF
Refatoração - aquela caprichada no código
PDF
Object Calisthenics em 10 minutos
PDF
Zend Expressive 3 e PSR-15
PDF
Criando uma API com Zend Expressive 3
PDF
Testes de API - Construindo uma suíte de testes para suas APIs
PDF
Slides Testes de API com Codeception
PDF
Php, por onde começar
PDF
Slides palestra codeception
Refatoração - aquela caprichada no código
Object Calisthenics em 10 minutos
Zend Expressive 3 e PSR-15
Criando uma API com Zend Expressive 3
Testes de API - Construindo uma suíte de testes para suas APIs
Slides Testes de API com Codeception
Php, por onde começar
Slides palestra codeception

Recently uploaded (20)

PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Cloud computing and distributed systems.
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Encapsulation theory and applications.pdf
PDF
Empathic Computing: Creating Shared Understanding
PPTX
A Presentation on Artificial Intelligence
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
A comparative analysis of optical character recognition models for extracting...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Diabetes mellitus diagnosis method based random forest with bat algorithm
MYSQL Presentation for SQL database connectivity
sap open course for s4hana steps from ECC to s4
Cloud computing and distributed systems.
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Encapsulation theory and applications.pdf
Empathic Computing: Creating Shared Understanding
A Presentation on Artificial Intelligence
Unlocking AI with Model Context Protocol (MCP)
Per capita expenditure prediction using model stacking based on satellite ima...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Spectral efficient network and resource selection model in 5G networks
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Machine learning based COVID-19 study performance prediction
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Network Security Unit 5.pdf for BCA BBA.
Chapter 3 Spatial Domain Image Processing.pdf
Programs and apps: productivity, graphics, security and other tools
A comparative analysis of optical character recognition models for extracting...

Does your code spark joy? Refactoring techniques to make your life easier.

  • 1. 1 @jucycabrera Does your code spark joy? Refactoring techniques to make your life easier
  • 2. 2 Juciellen Cabrera @jucycabrera Mother of a really smart boy PHP and Elephpants PHPWomen Living in Ireland Food lover Meme specialist Software Engineer at Smartbox Group
  • 3. 3 @jucycabrera Why talk about Refactoring? And then ...
  • 4. 4 @jucycabrera A change made to the internal structure of software to make it easier to understand and cheaper to modify without changing its observable behavior. Refactoring (noun) It’s also a common error to see refactoring as something to fix past mistakes or clean up ugly code.
  • 5. 5 @jucycabrera The idea that building an application that will not undergo any changes are untrue most of the time. As people change code to achieve short-term goals, often without a full comprehension of the architecture, the code loses its structure. Loss of structure has a cumulative effect. You will find yourself refactoring ugly code, but good code also needs refactoring.
  • 6. 6 @jucycabrera Self-testing code not only enables refactoring - it also makes it much safer to add new features, since any bugs introduced with the new feature can be quickly found and fixed. First things first...
  • 7. 7 @jucycabrera Bad Smells Smudge, originally known as Cascão, is one of the main characters of Monica's Gang. He never takes a bath, he hates water and never, ever touches it.
  • 8. 8 @jucycabrera Mysterious Name When you can’t think of a good name for something, it’s often a sign of a deeper issue.
  • 9. 9 @jucycabrera Duplicated Code Means that every time you read these copies, you need to read them carefully to see if there’s any difference.
  • 10. 10 @jucycabrera Long Function The longer the function, the more difficult is to understand. Large Class A class with too much code is a bad opportunity for duplicated code and chaos.
  • 11. 11 @jucycabrera Shotgun Surgery When every time you make a change, you have to make a lot of little edits to a lot of different classes.
  • 12. 12 @jucycabrera Long Parameter List Long parameter lists are often confusing. Primitive Obsession Primitive types, such as integers, floating pointing numbers and strings, don’t represent a type of data we are dealing with.
  • 13. 13 @jucycabrera Speculative Generality Things created before they are needed. ● Abstract class that isn’t doing much ● Unnecessary delegation ● Functions with unused parameters
  • 14. 14 @jucycabrera Repeated Switches It also applies to if statement. When the same conditional switching logic appears in different places and you add a clause, it is necessary to find all switches and update them.
  • 16. 16 @jucycabrera Comments When you feel the need to write a comment, first try to refactor the code so that any comment becomes unnecessary. Polemic topic!
  • 18. 18 @jucycabrera Extract Function If you have to spend effort looking at a block of code trying to figure out what it’s doing then you should extract it into a function. Inline Function Inverse of Extract Function, where a function has a body as clear as the name.
  • 19. 19 @jucycabrera Extract Class When you see a class that is too big to easily understand, you need to consider where it can be split. Inline Class When a class is no longer pulling its weight and shouldn’t be around anymore.
  • 20. 20 @jucycabrera Hide Delegate Encapsulation means that modules need to know less about other parts of the system. Remove Middle Man Opposite of Hide Delegate. Law of Demeter.
  • 21. 21 @jucycabrera Extract Variable Add a name to an expression that is complex and hard to read. Inline Variable When the name doesn’t really communicate more than the expression itself. Named properties PHP 8
  • 22. 22 @jucycabrera Change Function Declaration | Rename Method A good name allows you to understand what the function does when you see it called. Rename Variable Naming things well is at the heart of a clear programming. Rename Fields Fields names are important especially when they are widely used across an application.
  • 23. 23 @jucycabrera Encapsulate Collection Access to a collection variable may be encapsulated.
  • 24. 24 @jucycabrera Introduce Parameters Object Groups of data that are often together could be replaced by a data structure. Replace Primitive with Object e.g. Phone number, money Preserve Whole Object Values from the same object passed as an argument can be replaced by passing the whole object.
  • 25. 25 @jucycabrera Substitute Algorithm Replace the complicated logic with a simpler one by decomposing the method, or creating a new algorithm or even using a native function.
  • 26. 26 @jucycabrera Move Function | Move Field A nested function to a top level, or between classes. Slide Statements Code is easier to understand when things related to each other appear together.
  • 27. 27 @jucycabrera Split Loop You ensure you only need to understand one thing a time. Separate refactoring from optimization. $averageAge = 0; $totalSalary = 0; foreach ($people as $person) { $averageAge += $person->page; $totalSalary += $person->salary; } $averageAge = $averageAge / count($people); $averageAge = 0; $totalSalary = 0; foreach ($people as $person) { $averageAge += $person->page; } foreach ($people as $person) { $totalSalary += $person->salary; } $averageAge = $averageAge / count($people);
  • 28. 28 @jucycabrera Remove Dead Code Commenting out dead code is a common habit. Don’t be afraid to delete dead code. We have version control. Joelma: One of Brazil’s Queens
  • 29. 29 @jucycabrera Decomposite Conditional Apply “Extract Function” on the condition and each leg of the conditional. if ($date->before(SUMMER_START) || $date->after(SUMMER_END)) { $charge = $quantity * $winterRate + $winterServiceCharge; } else { $charge = $quantity * $summerRate; } if (isSummer($date)) { $charge = summerCharge($quantity); } else { $charge = winterCharge($quantity); }
  • 30. 30 @jucycabrera Replace Nested Conditional with Guard Clauses By reversing the conditions for example. function getPayAmount() { if ($this->isDead) { $result = $this->deadAmount(); } else { if ($this->isSeparated) { $result = $this->separatedAmount(); } else { if ($this->isRetired) { $result = $this->retiredAmount(); } else { $result = $this->normalPayAmount(); } } } return $result; } function getPayAmount() { if ($this->isDead) { return $this->deadAmount(); } if ($this->isSeparated) { return $this->separatedAmount(); } if ($this->isRetired) { return $this->retiredAmount(); } return $this->normalPayAmount(); }
  • 31. 31 @jucycabrera Replace Conditional with Polymorphism Create subclasses matching the branches of the conditional. abstract class Bird { // ... abstract function getSpeed(); // ... } class European extends Bird { public function getSpeed() { return $this->getBaseSpeed(); } } class African extends Bird { public function getSpeed() { return $this->getBaseSpeed() - $this->getLoadFactor() * $this->numberOfCoconuts; } } class NorwegianBlue extends Bird { public function getSpeed() { return ($this->isNailed) ? 0 : $this->getBaseSpeed($this->voltage); } } // Somewhere in Client code. $speed = $bird->getSpeed(); class Bird { // ... public function getSpeed() { switch ($this->type) { case EUROPEAN: return $this->getBaseSpeed(); case AFRICAN: return $this->getBaseSpeed() - $this->getLoadFactor() * $this->numberOfCoconuts; case NORWEGIAN_BLUE: return ($this->isNailed) ? 0 : $this->getBaseSpeed($this->voltage); } throw new Exception("Should be unreachable"); } // ... }
  • 32. 32 @jucycabrera Introduce Special Case | Null Object A class that provides special behavior for particular cases. if ($customer === null) { $plan = BillingPlan::basic(); } else { $plan = $customer->getPlan(); } class NullCustomer extends Customer { public function isNull() { return true; } public function getPlan() { return new NullPlan(); } // Some other NULL functionality. } // Replace null values with Null-object. $customer = ($order->customer !== null) ? $order->customer : new NullCustomer; // Use Null-object as if it's normal subclass. $plan = $customer->getPlan();
  • 33. 33 @jucycabrera Separate Query from Modifier A function that returns a value should not have observable side effects. The famous case of findAndDoSomethingElse.
  • 34. 34 @jucycabrera Parameterize Function Functions that have similar logic with different values can be removed by using a single function with parameters.
  • 35. 35 @jucycabrera Remove Flag Argument Flag argument is used to indicate which logic the function should execute. It’s clear to provide an explicit function for each task.
  • 36. 36 @jucycabrera Replace Constructor with Factory Function By creating a single point where the class is instantiated you avoid tight coupling. class Employee { // ... public function __construct($type) { $this->type = $type; } // ... } class Employee { // ... static public function create($type) { $employee = new Employee($type); // do some heavy lifting. return $employee; } // ... }
  • 37. 37 @jucycabrera Extract Super class Pull Up Method Pull Up Field Push Down Method Push Down Field Dealing with Inheritance
  • 38. 38 @jucycabrera The key to effective refactoring is recognizing that you go faster when you take tiny steps Martin Fowler
  • 39. 39 @jucycabrera Tips Keep an eye on updates PHP8 is live! Tests first! Create them if you don’t have any Tiny steps Don’t waste an opportunity to improve code Code review is a chance to discuss changes
  • 40. 40 @jucycabrera Find more by Martin Fowler, with Kent Beck 2018 - 2nd edition https://martinfowler.com/books/refactoring.html Refactoring Improving the Design of Existing Code https://refactoring.guru