SlideShare ist ein Scribd-Unternehmen logo
1 von 18
The
Hitchhikers
Guide to the
Legacy
sitHVR | 11 May 2019 | Laurens van Rijn
SAP Inside Track presentation
Agenda
Today’s topics
―What is Legacy Code?
―Is Legacy Code bad?
―Is Legacy Code good?
―The way forward
―Working with Legacy Code
―Want to know more?
―Q&A
HHGtt
Legacy
… in large friendly letters on its cover.
HHGtt
Legacy
What is Legacy Code? (1/2)
Some definitions…
―“Code where you can see the different programming styles of all the
developers who ever worked on it” – Ginny Hendry
―“Code that we don't like any more for whatever reason (typically because
it's not cool or fashionable but it works” – Dan Dyer
―“The code base or platform on which it is built is so old that getting qualified
or experienced developers for the system is both hard and expensive” –
Anonymous
―“ABAP code, riddled with deprecated statements (OCCURS etc.), usually
written under considerable time pressure and badly documented by
developers who have since left the company and who laugh at you upon
learning you’re supporting their code when meeting them at events” – Me
―“Simply code without tests” – Michael Feathers
HHGtt
Legacy
What is Legacy Code? (2/2)
Our working definition
“Code without tests is a bad code. It doesn’t matter how well written it is; how
well structured it is; how well encapsulated it is. Without tests there is no way
to tell if our code is getting better or worse.” – Michael Feathers
Please note: Your Legacy Code is not the same as your Code Legacy. The
latter partly determines your standing in the company as well as the likelihood
you’ll be invited back for another assignment.
HHGtt
Legacy
Is Legacy Code bad?
(Spoiler alert) Of course it’s not…
Legacy Code…
―Supports the company’s business processes
―Brings in revenue
―Provides learning moments and challenging puzzles
HHGtt
Legacy
Is Legacy Code good?
(Spoiler alert) Of course it’s not…
Legacy Code is…
―Complicated
―Likely to fall apart when touched
―Time consuming
―Bad for morale
The business may become hesitant to change due to the risks and
costs of changing legacy code.
HHGtt
Legacy
Legacy (Code) is everywhere…
HHGtt
Legacy
The way forward (1/2)
Why should we want to get a grip on Legacy Code?
―Improved efficiency
―Reduced development costs
―Improved product quality
―Lower learning curve
Thereby allowing the business the freedom to change as needed and be
supported by their software systems.
HHGtt
Legacy
The way forward (2/2)
How can we achieve this?
―Edit & Pray vs Cover & Modify
―Test Driven Development
The Legacy Code Dilemma: when we change code, we want to have tests
in place. To put tests in place, we need to change code. So, we…
―Identify change points
―Find test points
―Break dependencies
―Write tests
―Make changes and refactor
HHGtt
Legacy
Working with Legacy Code (1/5)
Identify change points
―I don’t understand the code well enough to change it
1. Sketching
2. Listing mark-up
3. Scratch refactoring
4. Delete unused code
―My application has no structure
1. Telling the story
2. Naked CRC
HHGtt
Legacy
Working with Legacy Code (2/5)
Find test points
―I need to make a change, what methods should I test?
1. Effect analysis → Effect sketch
2. Where are values changed, stored and who is using them?
―I need to make many changes in one area, do I have to break
dependencies for all the classes involved?
1. (High level) interception points
2. Pinch points
HHGtt
Legacy
Working with Legacy Code (3/5)
Break dependencies
―How do I know I’m not breaking anything?
1. Hyperaware & single goal editing
2. Preserve signatures
3. “Use the Compiler, Luke”
4. Pair programming
―I need to change a monster method and I can’t write tests for it
1. A plethora of monsters (bulleted, snarled, and mixed)
2. Refactoring: automated or manual
HHGtt
Legacy
Working with Legacy Code (4/5)
Write tests
―I need to make a change but I don’t know what tests to write
1. Use characterization tests (from failure to good result)
2. What if you encounter bugs?
―My test code is in the way
1. Naming conventions (FAKE… / …TEST / TESTING…)
2. Documentation
HHGtt
Legacy
Working with Legacy Code (5/5)
Make changes and refactor
―I don’t have much time and I have to change it
1. Sprout
2. Wrap
―I’m changing the same code all over the place
1. Necessary to remove redundancy?
2. Extract the difference from similar methods and use a common method
3. Open / Closed principle
HHGtt
Legacy
Want to know more?
The book (contains so much more, worth reading)
―https://www.goodreads.com/book/show/44919.Working_Effectively_with_Le
gacy_Code
Literature
―https://en.wikipedia.org/wiki/Legacy_code
―https://stackoverflow.com/questions/479596/what-makes-code-legacy
―https://en.wikipedia.org/wiki/Test-driven_development
―https://en.wikipedia.org/wiki/Technical_debt
―https://en.wikipedia.org/wiki/Towel_Day
―https://open.sap.com/courses/wtc1
HHGtt
Legacy
Say hello
to Q&A
Thank you for the attention…
HHGtt
Legacy

Weitere ähnliche Inhalte

Was ist angesagt?

Bdd agile requirements
Bdd agile requirementsBdd agile requirements
Bdd agile requirementsAgile Vietnam
 
Big Ball of Mud: Software Maintenance Nightmares
Big Ball of Mud: Software Maintenance NightmaresBig Ball of Mud: Software Maintenance Nightmares
Big Ball of Mud: Software Maintenance NightmaresGonzalo Rodríguez
 
WordCamp Pune 2017- WordPress Coding standards
WordCamp Pune 2017- WordPress Coding standardsWordCamp Pune 2017- WordPress Coding standards
WordCamp Pune 2017- WordPress Coding standardsSwapnil Patil
 
Behavior driven development (bdd)
Behavior driven development (bdd)Behavior driven development (bdd)
Behavior driven development (bdd)Rohit Bisht
 
Behavior Driven Development with AngularJS & Jasmine
Behavior Driven Development with AngularJS & JasmineBehavior Driven Development with AngularJS & Jasmine
Behavior Driven Development with AngularJS & JasmineRemus Langu
 
Six Steps to Conversation Driven Development
Six Steps to Conversation Driven DevelopmentSix Steps to Conversation Driven Development
Six Steps to Conversation Driven DevelopmentRasa Technologies
 
Best Practices of Software Development
Best Practices of Software DevelopmentBest Practices of Software Development
Best Practices of Software DevelopmentFolio3 Software
 
Test Driven Development Powered by LEGO
Test Driven Development Powered by LEGOTest Driven Development Powered by LEGO
Test Driven Development Powered by LEGOAgile Montréal
 
“One man” development process model
“One man” development process model“One man” development process model
“One man” development process modelSilicon Straits
 
Code quality
Code qualityCode quality
Code qualityProvectus
 
Portrait of professional developer 2.0
Portrait of professional developer 2.0Portrait of professional developer 2.0
Portrait of professional developer 2.0Mikalai Alimenkou
 
Agile code quality metrics
Agile code quality metricsAgile code quality metrics
Agile code quality metricsGil Nahmias
 
Tdd 왜 배우기 어려운가
Tdd 왜 배우기 어려운가Tdd 왜 배우기 어려운가
Tdd 왜 배우기 어려운가Jaehoon Oh
 
Deep Coder - Experimental Research Presentation
Deep Coder - Experimental Research PresentationDeep Coder - Experimental Research Presentation
Deep Coder - Experimental Research PresentationDUONG Dinh Cuong
 

Was ist angesagt? (20)

Code Quality Assurance
Code Quality AssuranceCode Quality Assurance
Code Quality Assurance
 
Bdd agile requirements
Bdd agile requirementsBdd agile requirements
Bdd agile requirements
 
Big Ball of Mud: Software Maintenance Nightmares
Big Ball of Mud: Software Maintenance NightmaresBig Ball of Mud: Software Maintenance Nightmares
Big Ball of Mud: Software Maintenance Nightmares
 
WordCamp Pune 2017- WordPress Coding standards
WordCamp Pune 2017- WordPress Coding standardsWordCamp Pune 2017- WordPress Coding standards
WordCamp Pune 2017- WordPress Coding standards
 
Behavior driven development (bdd)
Behavior driven development (bdd)Behavior driven development (bdd)
Behavior driven development (bdd)
 
Quick Intro to Clean Coding
Quick Intro to Clean CodingQuick Intro to Clean Coding
Quick Intro to Clean Coding
 
Make a better with clean code
Make a better with clean codeMake a better with clean code
Make a better with clean code
 
Behavior Driven Development with AngularJS & Jasmine
Behavior Driven Development with AngularJS & JasmineBehavior Driven Development with AngularJS & Jasmine
Behavior Driven Development with AngularJS & Jasmine
 
Six Steps to Conversation Driven Development
Six Steps to Conversation Driven DevelopmentSix Steps to Conversation Driven Development
Six Steps to Conversation Driven Development
 
Best Practices of Software Development
Best Practices of Software DevelopmentBest Practices of Software Development
Best Practices of Software Development
 
Test Driven Development Powered by LEGO
Test Driven Development Powered by LEGOTest Driven Development Powered by LEGO
Test Driven Development Powered by LEGO
 
“One man” development process model
“One man” development process model“One man” development process model
“One man” development process model
 
Design Smells
Design SmellsDesign Smells
Design Smells
 
Code quality
Code qualityCode quality
Code quality
 
Portrait of professional developer 2.0
Portrait of professional developer 2.0Portrait of professional developer 2.0
Portrait of professional developer 2.0
 
Agile code quality metrics
Agile code quality metricsAgile code quality metrics
Agile code quality metrics
 
Tdd 왜 배우기 어려운가
Tdd 왜 배우기 어려운가Tdd 왜 배우기 어려운가
Tdd 왜 배우기 어려운가
 
Code detox
Code detoxCode detox
Code detox
 
Why do you say BDD if it is Cucumber?
Why do you say BDD if it is Cucumber?Why do you say BDD if it is Cucumber?
Why do you say BDD if it is Cucumber?
 
Deep Coder - Experimental Research Presentation
Deep Coder - Experimental Research PresentationDeep Coder - Experimental Research Presentation
Deep Coder - Experimental Research Presentation
 

Ähnlich wie sitHVR - The Hitchhikers Guide to the Legacy

20191116 DevFest 2019 The Legacy Code came to stay (El legacy vino para queda...
20191116 DevFest 2019 The Legacy Code came to stay (El legacy vino para queda...20191116 DevFest 2019 The Legacy Code came to stay (El legacy vino para queda...
20191116 DevFest 2019 The Legacy Code came to stay (El legacy vino para queda...Antonio de la Torre Fernández
 
Structured Software Design
Structured Software DesignStructured Software Design
Structured Software DesignGiorgio Zoppi
 
Introducing systems analysis, design & development Concepts
Introducing systems analysis, design & development ConceptsIntroducing systems analysis, design & development Concepts
Introducing systems analysis, design & development ConceptsShafiul Azam Chowdhury
 
Technologies for startup
Technologies for startupTechnologies for startup
Technologies for startupDzung Nguyen
 
TDD - Cultivating a Beginner's Mind
TDD -  Cultivating a Beginner's MindTDD -  Cultivating a Beginner's Mind
TDD - Cultivating a Beginner's MindShai Yallin
 
Introducing Systems Analysis Design Development
Introducing Systems Analysis Design DevelopmentIntroducing Systems Analysis Design Development
Introducing Systems Analysis Design Developmentbsadd
 
How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....Mike Harris
 
Workshop fight legacy code write unit test
Workshop fight legacy code write unit testWorkshop fight legacy code write unit test
Workshop fight legacy code write unit testTung Nguyen Thanh
 
[XPday.vn] Legacy code workshop (at) [XP Day Vietnam 2015]
[XPday.vn] Legacy code workshop (at) [XP Day Vietnam 2015][XPday.vn] Legacy code workshop (at) [XP Day Vietnam 2015]
[XPday.vn] Legacy code workshop (at) [XP Day Vietnam 2015]Agile đây Vietnam
 
Practices of agile developers
Practices of agile developersPractices of agile developers
Practices of agile developersDUONG Trong Tan
 
Camunda Chapter Hamburg - Surviving the hyperautomation low code bubble
Camunda Chapter Hamburg - Surviving the hyperautomation low code bubbleCamunda Chapter Hamburg - Surviving the hyperautomation low code bubble
Camunda Chapter Hamburg - Surviving the hyperautomation low code bubbleBernd Ruecker
 
Agile Methodologies And Extreme Programming
Agile Methodologies And Extreme ProgrammingAgile Methodologies And Extreme Programming
Agile Methodologies And Extreme ProgrammingUtkarsh Khare
 
Code quality as a built-in process
Code quality as a built-in processCode quality as a built-in process
Code quality as a built-in processElad Maimon
 
Agile Methodologies And Extreme Programming - Svetlin Nakov
Agile Methodologies And Extreme Programming - Svetlin NakovAgile Methodologies And Extreme Programming - Svetlin Nakov
Agile Methodologies And Extreme Programming - Svetlin NakovSvetlin Nakov
 
Technical debt management strategies
Technical debt management strategiesTechnical debt management strategies
Technical debt management strategiesRaquel Pau
 
When to Code / Config / Config + Code in Salesforce - Nikunj Doshi
When to Code / Config / Config + Code in Salesforce - Nikunj DoshiWhen to Code / Config / Config + Code in Salesforce - Nikunj Doshi
When to Code / Config / Config + Code in Salesforce - Nikunj DoshiSakthivel Madesh
 
ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons LearnedITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons LearnedJoão Pedro Martins
 
Software as a craft (February, 2018)
Software as a craft (February, 2018)Software as a craft (February, 2018)
Software as a craft (February, 2018)Rachel M. Carmena
 
What would Jesus Developer do?
What would Jesus Developer do?What would Jesus Developer do?
What would Jesus Developer do?Lukáš Čech
 

Ähnlich wie sitHVR - The Hitchhikers Guide to the Legacy (20)

20191116 DevFest 2019 The Legacy Code came to stay (El legacy vino para queda...
20191116 DevFest 2019 The Legacy Code came to stay (El legacy vino para queda...20191116 DevFest 2019 The Legacy Code came to stay (El legacy vino para queda...
20191116 DevFest 2019 The Legacy Code came to stay (El legacy vino para queda...
 
Structured Software Design
Structured Software DesignStructured Software Design
Structured Software Design
 
Introducing systems analysis, design & development Concepts
Introducing systems analysis, design & development ConceptsIntroducing systems analysis, design & development Concepts
Introducing systems analysis, design & development Concepts
 
Technologies for startup
Technologies for startupTechnologies for startup
Technologies for startup
 
TDD - Cultivating a Beginner's Mind
TDD -  Cultivating a Beginner's MindTDD -  Cultivating a Beginner's Mind
TDD - Cultivating a Beginner's Mind
 
Introducing Systems Analysis Design Development
Introducing Systems Analysis Design DevelopmentIntroducing Systems Analysis Design Development
Introducing Systems Analysis Design Development
 
How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....
 
Workshop fight legacy code write unit test
Workshop fight legacy code write unit testWorkshop fight legacy code write unit test
Workshop fight legacy code write unit test
 
[XPday.vn] Legacy code workshop (at) [XP Day Vietnam 2015]
[XPday.vn] Legacy code workshop (at) [XP Day Vietnam 2015][XPday.vn] Legacy code workshop (at) [XP Day Vietnam 2015]
[XPday.vn] Legacy code workshop (at) [XP Day Vietnam 2015]
 
Practices of agile developers
Practices of agile developersPractices of agile developers
Practices of agile developers
 
Camunda Chapter Hamburg - Surviving the hyperautomation low code bubble
Camunda Chapter Hamburg - Surviving the hyperautomation low code bubbleCamunda Chapter Hamburg - Surviving the hyperautomation low code bubble
Camunda Chapter Hamburg - Surviving the hyperautomation low code bubble
 
Agile Methodologies And Extreme Programming
Agile Methodologies And Extreme ProgrammingAgile Methodologies And Extreme Programming
Agile Methodologies And Extreme Programming
 
Code quality as a built-in process
Code quality as a built-in processCode quality as a built-in process
Code quality as a built-in process
 
Agile Methodologies And Extreme Programming - Svetlin Nakov
Agile Methodologies And Extreme Programming - Svetlin NakovAgile Methodologies And Extreme Programming - Svetlin Nakov
Agile Methodologies And Extreme Programming - Svetlin Nakov
 
Technical debt management strategies
Technical debt management strategiesTechnical debt management strategies
Technical debt management strategies
 
When to Code / Config / Config + Code in Salesforce - Nikunj Doshi
When to Code / Config / Config + Code in Salesforce - Nikunj DoshiWhen to Code / Config / Config + Code in Salesforce - Nikunj Doshi
When to Code / Config / Config + Code in Salesforce - Nikunj Doshi
 
ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons LearnedITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
 
Raising the Bar
Raising the BarRaising the Bar
Raising the Bar
 
Software as a craft (February, 2018)
Software as a craft (February, 2018)Software as a craft (February, 2018)
Software as a craft (February, 2018)
 
What would Jesus Developer do?
What would Jesus Developer do?What would Jesus Developer do?
What would Jesus Developer do?
 

Kürzlich hochgeladen

Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
cpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptcpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptrcbcrtm
 

Kürzlich hochgeladen (20)

Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
cpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptcpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.ppt
 

sitHVR - The Hitchhikers Guide to the Legacy

  • 1. The Hitchhikers Guide to the Legacy sitHVR | 11 May 2019 | Laurens van Rijn SAP Inside Track presentation
  • 2. Agenda Today’s topics ―What is Legacy Code? ―Is Legacy Code bad? ―Is Legacy Code good? ―The way forward ―Working with Legacy Code ―Want to know more? ―Q&A HHGtt Legacy
  • 3. … in large friendly letters on its cover. HHGtt Legacy
  • 4. What is Legacy Code? (1/2) Some definitions… ―“Code where you can see the different programming styles of all the developers who ever worked on it” – Ginny Hendry ―“Code that we don't like any more for whatever reason (typically because it's not cool or fashionable but it works” – Dan Dyer ―“The code base or platform on which it is built is so old that getting qualified or experienced developers for the system is both hard and expensive” – Anonymous ―“ABAP code, riddled with deprecated statements (OCCURS etc.), usually written under considerable time pressure and badly documented by developers who have since left the company and who laugh at you upon learning you’re supporting their code when meeting them at events” – Me ―“Simply code without tests” – Michael Feathers HHGtt Legacy
  • 5. What is Legacy Code? (2/2) Our working definition “Code without tests is a bad code. It doesn’t matter how well written it is; how well structured it is; how well encapsulated it is. Without tests there is no way to tell if our code is getting better or worse.” – Michael Feathers Please note: Your Legacy Code is not the same as your Code Legacy. The latter partly determines your standing in the company as well as the likelihood you’ll be invited back for another assignment. HHGtt Legacy
  • 6. Is Legacy Code bad? (Spoiler alert) Of course it’s not… Legacy Code… ―Supports the company’s business processes ―Brings in revenue ―Provides learning moments and challenging puzzles HHGtt Legacy
  • 7. Is Legacy Code good? (Spoiler alert) Of course it’s not… Legacy Code is… ―Complicated ―Likely to fall apart when touched ―Time consuming ―Bad for morale The business may become hesitant to change due to the risks and costs of changing legacy code. HHGtt Legacy
  • 8. Legacy (Code) is everywhere… HHGtt Legacy
  • 9. The way forward (1/2) Why should we want to get a grip on Legacy Code? ―Improved efficiency ―Reduced development costs ―Improved product quality ―Lower learning curve Thereby allowing the business the freedom to change as needed and be supported by their software systems. HHGtt Legacy
  • 10. The way forward (2/2) How can we achieve this? ―Edit & Pray vs Cover & Modify ―Test Driven Development The Legacy Code Dilemma: when we change code, we want to have tests in place. To put tests in place, we need to change code. So, we… ―Identify change points ―Find test points ―Break dependencies ―Write tests ―Make changes and refactor HHGtt Legacy
  • 11. Working with Legacy Code (1/5) Identify change points ―I don’t understand the code well enough to change it 1. Sketching 2. Listing mark-up 3. Scratch refactoring 4. Delete unused code ―My application has no structure 1. Telling the story 2. Naked CRC HHGtt Legacy
  • 12. Working with Legacy Code (2/5) Find test points ―I need to make a change, what methods should I test? 1. Effect analysis → Effect sketch 2. Where are values changed, stored and who is using them? ―I need to make many changes in one area, do I have to break dependencies for all the classes involved? 1. (High level) interception points 2. Pinch points HHGtt Legacy
  • 13. Working with Legacy Code (3/5) Break dependencies ―How do I know I’m not breaking anything? 1. Hyperaware & single goal editing 2. Preserve signatures 3. “Use the Compiler, Luke” 4. Pair programming ―I need to change a monster method and I can’t write tests for it 1. A plethora of monsters (bulleted, snarled, and mixed) 2. Refactoring: automated or manual HHGtt Legacy
  • 14. Working with Legacy Code (4/5) Write tests ―I need to make a change but I don’t know what tests to write 1. Use characterization tests (from failure to good result) 2. What if you encounter bugs? ―My test code is in the way 1. Naming conventions (FAKE… / …TEST / TESTING…) 2. Documentation HHGtt Legacy
  • 15. Working with Legacy Code (5/5) Make changes and refactor ―I don’t have much time and I have to change it 1. Sprout 2. Wrap ―I’m changing the same code all over the place 1. Necessary to remove redundancy? 2. Extract the difference from similar methods and use a common method 3. Open / Closed principle HHGtt Legacy
  • 16. Want to know more? The book (contains so much more, worth reading) ―https://www.goodreads.com/book/show/44919.Working_Effectively_with_Le gacy_Code Literature ―https://en.wikipedia.org/wiki/Legacy_code ―https://stackoverflow.com/questions/479596/what-makes-code-legacy ―https://en.wikipedia.org/wiki/Test-driven_development ―https://en.wikipedia.org/wiki/Technical_debt ―https://en.wikipedia.org/wiki/Towel_Day ―https://open.sap.com/courses/wtc1 HHGtt Legacy
  • 18. Thank you for the attention… HHGtt Legacy

Hinweis der Redaktion

  1. This presentation is future proof and cloud ready. You can start using it today and it will continue to work…
  2. 0 Question for the audience… 1 Legacy Code is un[clean code]... 1 “How your code will be viewed by the next generation of developers” – Ginny Hendry 1 “Rotten code” – Robert Martin 2 Difference between Legacy Code and your Code Legacy: your Code Legacy will influence the chance of being asked for other/repeat assignments…
  3. Unit Testing (error localization, execution time and coverage)
  4. For all methods you change. Is that enough? Low coupling, high cohesion. Find all object that can influence the objects you’re changing Global and static variables, super and subclasses. Interception Point: where you can detect the effects of a change. Pinch Point: where a test for a few methods can detect the changes in many methods.
  5. Book dates from 2005, version management and new tools negate 2 and 3. Pretty Printer helps too. Code Inspector allows you to set limits on number of lines, reducing the likelihood of monster spawning. Extract what you know, gleaning dependencies (test what is critical), extract small pieces
  6. 1) First create a failure. Based on the result of that failure you’ll now what is needed to make it pass. 2) Bugs are a byproduct; you’re documenting the behavior of the code for future use to avoid doing it again and again…
  7. Add new code in a new method. +Code is separated. – Old code still not improved. Class combines multiple methods. + New code centralized. – Hierarchy muddled. New method calls the old method and does something before or after the call. Class wraps an entire class. Do this for completely unrelated behavior or to limit the wrapped class in functionality. Fighting redundancy… Not always relevant Refactoring: a change made to the internal structure of the code to make it easier to understand and cheaper to modify without changing its existing behavior… Open for extension, closed for modification.