SlideShare a Scribd company logo
Working effectively
with legacy code
Workshop 2017-04-10
About me
Audrius Kovalenko | @slicklash
NOT Software Archaeologist
Just a developer
What’s a legacy code?
What’s a legacy code?
In production
Functional
Business value
Must keep working
Outdated
Expensive and difficult changes
High cognitive load
No tests
etc.
Legacy Code
What’s a legacy code?
“A complex system that works has evolved from
a simple system that worked.
Maintainability is a hard problem
system growth is organic
“A complex system that works has evolved from
a simple system that worked.
A complex system designed from scratch
never works and cannot be patched up to work.”
Gall’s law
Maintainability is a hard problem
system growth is organic
Maintainability is a hard problem
emergent design is hard
solution initially looks like
an attractive road with
flowers...
Maintainability is a hard problem
emergent design is hard
https://martinfowler.com/bliki/AntiPattern.html
solution initially looks like
an attractive road with
flowers...
... but further on leads you
into the maze of monsters
“Any piece of software reflects the
organizational structure that produced it.”
Conway's law
Maintainability is a hard problem
imposed things are hard to escape
QUALITY
TIME COST
expensive late
bad
quality
scope
change
Maintainability is a hard problem
project management triangle
QUALITY
TIME COST
expensive late
bad
quality
scope
change
Maintainability is a hard problem
project management triangle
Brooks’s law
Parkinson's law
Hofstadter's law
Roots of evil
complexity
“The number of objects an
average person can hold in
working memory is about
seven.”
Miller's law
7±2
Roots of evil
complexity
“The number of objects an
average person can hold in
working memory is about
seven.”
Miller's law
7±2
Complexity limits what we can do
Roots of evil
complexity
How easy is it to change a single element?
How does the change propagate?
Roots of evil
complexity
dumb dumbunder-engineering over-engineeringsimple complex
Roots of evil
complexity
quick
hacks
spaghettiduplicates
and globals
inception layersseparation composition
Roots of evil
complexity
“Simple is better than complex.
Complex is better than complicated.”
from The Zen of Python, by Tim Peters
https://www.python.org/dev/peps/pep-0020/
Roots of evil
complexity
measuring complexity
with
https://www.sonarqube.org/
Roots of evil
complexity
“Simplicity and elegance are unpopular because
they require hard work and discipline to achieve
and education to be appreciated.”
E. W. Dijkstra
Roots of evil
entropy
How much information does a change carry?
What does constant high entropy mean?
Roots of evil
entropy
angular
Roots of evil
entropy
flask
Roots of evil
entropy
High entropy + frequent releases = bad combination
2.0.0-beta.0..1..2..3..4..5..6..7..8..9..10..11..12..13..14..15..16..17..
2.0.0-rc.0..1..2..3..4..5..6..7..
4.0.0-beta.0..1..2..3..4..5..6..7..
4.0.0-rc.1..2..3..4..5..6..
Roots of evil
entropy
The more parts of the system you need to modify
the harder it is to implement that change.
Roots of evil
entropy
Symptom of leaky abstractions and
tightly coupled dependencies
The more parts of the system you need to modify
the harder it is to implement that change.
Practice
measuring entropy
Approaching legacy code
systematic approach
Examine the system
Identify pain points and red flags
Create a master plan
Build a toolbox
Examine the system
know your system
“Chainsaw is supposed to be loud.”
Understand the system and know
what's usual and what's not.
Examine the system
know your system
Enumerate all components
Identify critical parts
Learn what not to do
Learn whom to seek if you did it anyway
Examine the system
know your system
Pain points and red flags
start asking for what’s wrong
List down everything what gives you pain
Pain points and red flags
start asking for what’s wrong
No domain expert is available
Memory bound code
Poor practices
3rd party locked-in
No tests and CI
No automation
Big feedback delays
etc.
Pain points and red flags
Agile vs agility
Create a master plan
goals and targets
Goals give direction and focus (what not to do)
Create a master plan
goals and targets
Goals give direction and focus (what not to do)
Relevant
Specific
Achievable
Measurable
Time-bound
Create a master plan
goals and targets
Challenge your limits
Think outside the box
Make X great again
Chakka-Chakka!
Bad goals
Create a master plan
goals and targets
People with realistic goals apply more
effort and perform better, and people with
unrealistic goals pull back.
Create a master plan
goals and targets
Focus on addressing
pain points
Build a toolbox
good plan is half the battle
Competence
Backups
VCS
Automation
Safety net
Playbook and Exercises
Documentation
Contingency plan
Dos and Don’ts
create value
Reduce complexity and guesswork
Keep entropy low
Track changes
Write clear commit messages
Deploy often
Invest in automation
Focus on preventing fire not putting it off
Dos and Don’ts
When Do
NPR rule
fixing a defect
adding new feature
refactoring
the necessary
be pragmatic
the right thing
Dos and Don’ts
fixing what’s not broken
Refactoring because it’s not your way is a waste.
Dos and Don’ts
fixing what’s not broken
Refactoring because it’s not your way is a waste.
Don’t touch components you are not going to change.
Practice
golden master
https://github.com/jbrains/trivia
You are not ready
for a big refactoring
Books
Resources
Catalog of Refactorings
https://refactoring.com/catalog/
Legacy Code Rocks!
http://legacycode.rocks/
Methods & Tools
http://www.methodsandtools.com/
QA

More Related Content

PPT
Working Effectively With Legacy Code
PPTX
Acceptance testing
PPT
Characteristics of c#
PPTX
Working with Legacy Code
PPTX
Unit1 principle of programming language
PPTX
Qt for beginners part 1 overview and key concepts
 
PPSX
Introduction to .net framework
PPTX
JAVA INTRODUCTION - 1
Working Effectively With Legacy Code
Acceptance testing
Characteristics of c#
Working with Legacy Code
Unit1 principle of programming language
Qt for beginners part 1 overview and key concepts
 
Introduction to .net framework
JAVA INTRODUCTION - 1

What's hot (20)

PPT
Exploring User Stories Through Mind mapping
PDF
Refactoring
PDF
Introduction to Qt programming
PDF
Strategic refactoring. Refactoring strategies
PPTX
Software engineering: design for reuse
PPT
Gray box testing
PPT
Authentication Protocols
PPTX
Gof design patterns
PPT
Managing People in Software Engineering SE22
PPTX
Code Review
PPT
Chapter 13 software testing strategies
PPTX
Stream Cipher.pptx
PPT
Learning typescript
PPT
Continuous integration
PPTX
Internet Protocol Version 4
PPTX
C# 101: Intro to Programming with C#
PDF
Logstage - zero-cost-tructured-logging
PPTX
Test Driven Development
PPTX
OpenSSL
PPTX
Assemblies
Exploring User Stories Through Mind mapping
Refactoring
Introduction to Qt programming
Strategic refactoring. Refactoring strategies
Software engineering: design for reuse
Gray box testing
Authentication Protocols
Gof design patterns
Managing People in Software Engineering SE22
Code Review
Chapter 13 software testing strategies
Stream Cipher.pptx
Learning typescript
Continuous integration
Internet Protocol Version 4
C# 101: Intro to Programming with C#
Logstage - zero-cost-tructured-logging
Test Driven Development
OpenSSL
Assemblies
Ad

Similar to Working Effectively with Legacy Code (20)

PPTX
Pragmatic programmer
PPTX
ROOTS2011 Continuous Delivery
PPTX
Continuous Delivery
PPTX
Winnipeg ISACA Security is Dead, Rugged DevOps
PDF
Identify Development Pains and Resolve Them with Idea Flow
PDF
SRE Topics with Charity Majors and Liz Fong-Jones of Honeycomb
PDF
The Rationale for Continuous Delivery
PDF
Creating An Incremental Architecture For Your System
PDF
From dev to ops and beyond - getting it done
PDF
Beyond Technical Debt: Unconventional techniques to uncover technical and soc...
PDF
Rules of development (and everything else for what matters)
PPTX
Large Components in the Rearview Mirror
PDF
Chaos Engineering Without Observability ... Is Just Chaos
PPTX
10 practices that every developer needs to start right now
PDF
From 🤦 to 🐿️
PDF
Architecting a Post Mortem - Velocity 2018 San Jose Tutorial
PPTX
Codemash 2.0.1.4: Tech Trends and Pwning Your Pwn Career
PDF
From DevOps to NoOps how not to get Equifaxed Apidays
PDF
More Aim, Less Blame: How to use postmortems to turn failures into something ...
KEY
Nysais presentation may 2010
Pragmatic programmer
ROOTS2011 Continuous Delivery
Continuous Delivery
Winnipeg ISACA Security is Dead, Rugged DevOps
Identify Development Pains and Resolve Them with Idea Flow
SRE Topics with Charity Majors and Liz Fong-Jones of Honeycomb
The Rationale for Continuous Delivery
Creating An Incremental Architecture For Your System
From dev to ops and beyond - getting it done
Beyond Technical Debt: Unconventional techniques to uncover technical and soc...
Rules of development (and everything else for what matters)
Large Components in the Rearview Mirror
Chaos Engineering Without Observability ... Is Just Chaos
10 practices that every developer needs to start right now
From 🤦 to 🐿️
Architecting a Post Mortem - Velocity 2018 San Jose Tutorial
Codemash 2.0.1.4: Tech Trends and Pwning Your Pwn Career
From DevOps to NoOps how not to get Equifaxed Apidays
More Aim, Less Blame: How to use postmortems to turn failures into something ...
Nysais presentation may 2010
Ad

More from slicklash (6)

PDF
Code Complexity and Entropy
PDF
This World of Ours
PDF
VGTU Intro to Threats 2015
PDF
Introduction to Threat Modeling
PDF
Cryptography (under)engineering
PDF
Security of Web Applications: Top 6 Risks To Avoid
Code Complexity and Entropy
This World of Ours
VGTU Intro to Threats 2015
Introduction to Threat Modeling
Cryptography (under)engineering
Security of Web Applications: Top 6 Risks To Avoid

Recently uploaded (20)

PDF
medical staffing services at VALiNTRY
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
ai tools demonstartion for schools and inter college
PPTX
L1 - Introduction to python Backend.pptx
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Essential Infomation Tech presentation.pptx
PDF
Nekopoi APK 2025 free lastest update
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
AI in Product Development-omnex systems
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
medical staffing services at VALiNTRY
wealthsignaloriginal-com-DS-text-... (1).pdf
ai tools demonstartion for schools and inter college
L1 - Introduction to python Backend.pptx
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Upgrade and Innovation Strategies for SAP ERP Customers
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Wondershare Filmora 15 Crack With Activation Key [2025
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Which alternative to Crystal Reports is best for small or large businesses.pdf
Essential Infomation Tech presentation.pptx
Nekopoi APK 2025 free lastest update
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Navsoft: AI-Powered Business Solutions & Custom Software Development
Design an Analysis of Algorithms I-SECS-1021-03
2025 Textile ERP Trends: SAP, Odoo & Oracle
AI in Product Development-omnex systems
How to Choose the Right IT Partner for Your Business in Malaysia

Working Effectively with Legacy Code