SlideShare a Scribd company logo
1 of 47
Taming Legacy Code Monsters
* Caleb * I’m here to help.
Last year 10Reasons yoursoftwareSucks (and the 10 practicesto fix it)
Building teams that engineer better software Development ∙ Team Work ∙ Process
back to… Taming Legacy Code Monsters
back to… Taming Legacy Code Monsters
Definition “Legacy” n. Software that I’m afraid to maintain, extend, or change it actually scares me to touch that code.
What’s the differencebetween an application and
Legacy Monster
Legacy Monster Processor Static Config Static Proxy Processor Settings Data Connections Rules Configurations Coupling Coupling Coupling Coupling Coupling Rules Data Coupling
Legacy Monster Solution contained over 68 projects. Most of which were notused. No horizontal layers. Required IIS 6 / legacy URL rewriter / 32 bit C Lib / IIS Rules export/import / Database Connections / Proper Configuration X 3 To run or test ANY part on a dev box…
Strategy #1 Know your Foe
Strategy #1 nDepend
Strategy #1 Visual Studio Dependency Graph
Strategy #1 Demo Using theVisual Studio Dependency Graph
Strategy #1 Demo Pro tip:Look for big blobs& thick linesto concrete types
Strategy #2 Create aSafety Net
Source Control+ Test Strategy #2
Strategy #2 Source Control+ Test
Strategy #2 Source Control
// source // svn / git / tfs  ..  // r1.1 // r1 // r2 // r3 // trunk // trunk Branching for FUN! //
Strategy #2 Unit TestsIntegration Regression Load Tests Etc… Tests
Isolation and White box Unit Testing for .NET Demo: Safety Net Legacy Monster “Pexautomatically generates test suites with high code coverage.…[and] finds interesting input-output values of your methods, which you can save as a small test suite with high code coverage. Microsoft Pex is a Visual Studio add-in for testing .NET Framework applications.” Processor Static Config Static IProxy Processor Settings Data Connections Rules Configurations http://research.microsoft.com/en-us/projects/pex/ Rules Data
what about hard to test code? refactoring testability
privateIList<Bean> goodBeans { get; set;} privateIList<Bean> badBeans { get; set;} publicvoidAddBean(Bean bean){ 	if(bean.size > 10) goodBeans.Add(bean); 	else badBeans.Add(bean); } publicvoidUpdateBeans(){ BeanData.Update(goodBeans); goodBeans.Clear(); badBeans.Clear(); }
1 Clearly an arbitrary example Does represent actual production code that I have worked with 2 3 AddBean(b); AddBean(b), UpdateBeans(); Usage scenario is How can we test the AddBean() Logic?
publicIList<Bean> GoodBeans{ get; private set;} privateIlist <Bean>badBeans{ get; set;} publicvoidAddBean(Bean bean){ if(bean.size > 10) GoodBeans.Add(bean); else badBeans.Add(bean); } publicvoidUpdateBeans(){ BeanData.Update(goodBeans); GoodBeans.Clear(); badBeans.Clear(); } privateIList<Bean> goodBeans { get; set;} privateIList<Bean> badBeans { get; set;} publicvoidAddBean(Bean bean){ 	if(bean.size > 10) goodBeans.Add(bean); 	else badBeans.Add(bean); } publicvoidUpdateBeans(){ BeanData.Update(goodBeans); goodBeans.Clear(); badBeans.Clear(); } A: create a readonlyaccessor to “sense” thegoodBean state externally
What about the UpdateBeans() method? publicvoidUpdateBeans(){ BeanData.Update(goodBeans); goodBeans.Clear(); badBeans.Clear(); } publicvoidUpdateBeans(){ BeanData.Update(goodBeans); goodBeans.Clear(); badBeans.Clear(); if (OnBeansUpdate != null) OnBeansUpdate(); } publiceventActionOnBeansUpdate;
Code Coverage + Continuous Integration Not a silver bullet still need to make sure that we are testing “the right” things, and not just hitting some magical number still need to make sure we have healthy tests Pro tip
Code Coverage + Continuous Integration Creates a base line or smoke test to look for Watch trends over magic percent numbers Pro tip
Code Coverage + Continuous Integration Team City Code Coverage
Code Coverage + Continuous Integration Sonar
Strategy #3
Strategy #3 Divide and Conquer  (pick your battles)
36 Commitment
37                            Raise your hand and repeat after me, Commitment
38                            Raise your hand and repeat after me, Commitment I will not practice bad code.
“Resist Legacy Coupling”
“Resist Legacy Coupling” tight coupling = change anywhereaffects everything Legacy Monster Processor Static Config Static Proxy Processor Settings Data Connections Rules Configurations New Functionality Coupling Needs IProxy Coupling static Config class leads to Heavy Weight testing Coupling Coupling Coupling Rules Data don’t reference Config Monster Coupling use DI for only what you need (IProxy)
Introduce SOLID principals on new development… gradually improve code over time http://developingux.com/di/
wrap up
Know your Foe  wrap up Use a Safety Net Divide and  Conquer
Thank you! Proaction MentorS @calebjenkins http://developingux.com @proactionmentor caleb@proactionmentors.com
Photo Credits © Michael Cummings - http://dreaminpictures.com http://www.flickr.com/photos/boogeyman13/2432667459/ http://www.flickr.com/photos/stopthegears/50553611/ http://www.flickr.com/photos/pochateca/324414459 http://www.flickr.com/photos/27620885@N02/2594362917
http://www.flickr.com/photos/27620885@N02/2594363003 http://www.flickr.com/photos/flyingturtle/3976070342/ http://www.flickr.com/photos/jfravel/1001472806/ http://www.flickr.com/photos/flyingturtle/3976076272/ http://www.lostechies.com/blogs/derickbailey/archive/2009/02/11/solid-development-principles-in-motivational-pictures.aspx

More Related Content

What's hot

Javaland 2017: "You´ll do microservices now". Now what?
Javaland 2017: "You´ll do microservices now". Now what?Javaland 2017: "You´ll do microservices now". Now what?
Javaland 2017: "You´ll do microservices now". Now what?André Goliath
 
Krebs Voos Save 76% in Virtual Worlds
Krebs Voos Save 76% in Virtual WorldsKrebs Voos Save 76% in Virtual Worlds
Krebs Voos Save 76% in Virtual WorldsAgile Dimensions LLC
 
How to run a kick ass bug bounty program - Node Summit 2013
How to run a kick ass bug bounty program - Node Summit 2013How to run a kick ass bug bounty program - Node Summit 2013
How to run a kick ass bug bounty program - Node Summit 2013bugcrowd
 
Das kannste schon so machen
Das kannste schon so machenDas kannste schon so machen
Das kannste schon so machenAndré Goliath
 
Attacking Pipelines--Security meets Continuous Delivery
Attacking Pipelines--Security meets Continuous DeliveryAttacking Pipelines--Security meets Continuous Delivery
Attacking Pipelines--Security meets Continuous DeliveryJames Wickett
 
What Makes Us Fail
What Makes Us FailWhat Makes Us Fail
What Makes Us FailGluster.org
 

What's hot (6)

Javaland 2017: "You´ll do microservices now". Now what?
Javaland 2017: "You´ll do microservices now". Now what?Javaland 2017: "You´ll do microservices now". Now what?
Javaland 2017: "You´ll do microservices now". Now what?
 
Krebs Voos Save 76% in Virtual Worlds
Krebs Voos Save 76% in Virtual WorldsKrebs Voos Save 76% in Virtual Worlds
Krebs Voos Save 76% in Virtual Worlds
 
How to run a kick ass bug bounty program - Node Summit 2013
How to run a kick ass bug bounty program - Node Summit 2013How to run a kick ass bug bounty program - Node Summit 2013
How to run a kick ass bug bounty program - Node Summit 2013
 
Das kannste schon so machen
Das kannste schon so machenDas kannste schon so machen
Das kannste schon so machen
 
Attacking Pipelines--Security meets Continuous Delivery
Attacking Pipelines--Security meets Continuous DeliveryAttacking Pipelines--Security meets Continuous Delivery
Attacking Pipelines--Security meets Continuous Delivery
 
What Makes Us Fail
What Makes Us FailWhat Makes Us Fail
What Makes Us Fail
 

Similar to Taming the Monster Legacy Code Beast

Advanced Continuous Integration - PyGrunn 2014 - Dirk Zittersteyn
Advanced Continuous Integration - PyGrunn 2014 - Dirk ZittersteynAdvanced Continuous Integration - PyGrunn 2014 - Dirk Zittersteyn
Advanced Continuous Integration - PyGrunn 2014 - Dirk ZittersteynDirk Zittersteyn
 
Achievement Unlocked: Drive development, increase velocity, and write blissfu...
Achievement Unlocked: Drive development, increase velocity, and write blissfu...Achievement Unlocked: Drive development, increase velocity, and write blissfu...
Achievement Unlocked: Drive development, increase velocity, and write blissfu...All Things Open
 
The servicescore card - Gamifying Operational Excellence - SRECON
The servicescore card - Gamifying Operational Excellence - SRECONThe servicescore card - Gamifying Operational Excellence - SRECON
The servicescore card - Gamifying Operational Excellence - SRECONDaniel ( Danny ) ☃ Lawrence
 
sbt 0.10 for beginners?
sbt 0.10 for beginners?sbt 0.10 for beginners?
sbt 0.10 for beginners?k4200
 
Adventures on live partitioning
Adventures on live partitioningAdventures on live partitioning
Adventures on live partitioningMatteo Melli
 
Maximize the power of OSGi
Maximize the power of OSGiMaximize the power of OSGi
Maximize the power of OSGiDavid Bosschaert
 
Maximise the Power of OSGi - Carsten Ziegeler & David Bosschaert
Maximise the Power of OSGi - Carsten Ziegeler & David BosschaertMaximise the Power of OSGi - Carsten Ziegeler & David Bosschaert
Maximise the Power of OSGi - Carsten Ziegeler & David Bosschaertmfrancis
 
DevSecCon SG 2018 Fabian Presentation Slides
DevSecCon SG 2018 Fabian Presentation SlidesDevSecCon SG 2018 Fabian Presentation Slides
DevSecCon SG 2018 Fabian Presentation SlidesFab L
 
Prophet - Beijing Perl Workshop
Prophet - Beijing Perl WorkshopProphet - Beijing Perl Workshop
Prophet - Beijing Perl WorkshopJesse Vincent
 
DevSecCon Singapore 2018 - Remove developers’ shameful secrets or simply rem...
DevSecCon Singapore 2018 -  Remove developers’ shameful secrets or simply rem...DevSecCon Singapore 2018 -  Remove developers’ shameful secrets or simply rem...
DevSecCon Singapore 2018 - Remove developers’ shameful secrets or simply rem...DevSecCon
 
Free The Enterprise With Ruby & Master Your Own Domain
Free The Enterprise With Ruby & Master Your Own DomainFree The Enterprise With Ruby & Master Your Own Domain
Free The Enterprise With Ruby & Master Your Own DomainKen Collins
 
Building Twitter's SDKs for Android
Building Twitter's SDKs for AndroidBuilding Twitter's SDKs for Android
Building Twitter's SDKs for AndroidAndy Piper
 
APIdays Helsinki 2019 - API Versioning with REST, JSON and Swagger with Thoma...
APIdays Helsinki 2019 - API Versioning with REST, JSON and Swagger with Thoma...APIdays Helsinki 2019 - API Versioning with REST, JSON and Swagger with Thoma...
APIdays Helsinki 2019 - API Versioning with REST, JSON and Swagger with Thoma...apidays
 
Ben ford intro
Ben ford introBen ford intro
Ben ford introPuppet
 
Telemetry doesn't have to be scary; Ben Ford
Telemetry doesn't have to be scary; Ben FordTelemetry doesn't have to be scary; Ben Ford
Telemetry doesn't have to be scary; Ben FordPuppet
 

Similar to Taming the Monster Legacy Code Beast (20)

Android data binding
Android data bindingAndroid data binding
Android data binding
 
Advanced Continuous Integration - PyGrunn 2014 - Dirk Zittersteyn
Advanced Continuous Integration - PyGrunn 2014 - Dirk ZittersteynAdvanced Continuous Integration - PyGrunn 2014 - Dirk Zittersteyn
Advanced Continuous Integration - PyGrunn 2014 - Dirk Zittersteyn
 
Achievement Unlocked: Drive development, increase velocity, and write blissfu...
Achievement Unlocked: Drive development, increase velocity, and write blissfu...Achievement Unlocked: Drive development, increase velocity, and write blissfu...
Achievement Unlocked: Drive development, increase velocity, and write blissfu...
 
The servicescore card - Gamifying Operational Excellence - SRECON
The servicescore card - Gamifying Operational Excellence - SRECONThe servicescore card - Gamifying Operational Excellence - SRECON
The servicescore card - Gamifying Operational Excellence - SRECON
 
sbt 0.10 for beginners?
sbt 0.10 for beginners?sbt 0.10 for beginners?
sbt 0.10 for beginners?
 
Adventures on live partitioning
Adventures on live partitioningAdventures on live partitioning
Adventures on live partitioning
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
Maximize the power of OSGi
Maximize the power of OSGiMaximize the power of OSGi
Maximize the power of OSGi
 
Maximise the Power of OSGi - Carsten Ziegeler & David Bosschaert
Maximise the Power of OSGi - Carsten Ziegeler & David BosschaertMaximise the Power of OSGi - Carsten Ziegeler & David Bosschaert
Maximise the Power of OSGi - Carsten Ziegeler & David Bosschaert
 
DevSecCon SG 2018 Fabian Presentation Slides
DevSecCon SG 2018 Fabian Presentation SlidesDevSecCon SG 2018 Fabian Presentation Slides
DevSecCon SG 2018 Fabian Presentation Slides
 
Data Binding in qooxdoo
Data Binding in qooxdooData Binding in qooxdoo
Data Binding in qooxdoo
 
VersionEEring
VersionEEringVersionEEring
VersionEEring
 
Prophet - Beijing Perl Workshop
Prophet - Beijing Perl WorkshopProphet - Beijing Perl Workshop
Prophet - Beijing Perl Workshop
 
DevSecCon Singapore 2018 - Remove developers’ shameful secrets or simply rem...
DevSecCon Singapore 2018 -  Remove developers’ shameful secrets or simply rem...DevSecCon Singapore 2018 -  Remove developers’ shameful secrets or simply rem...
DevSecCon Singapore 2018 - Remove developers’ shameful secrets or simply rem...
 
Free The Enterprise With Ruby & Master Your Own Domain
Free The Enterprise With Ruby & Master Your Own DomainFree The Enterprise With Ruby & Master Your Own Domain
Free The Enterprise With Ruby & Master Your Own Domain
 
Building Twitter's SDKs for Android
Building Twitter's SDKs for AndroidBuilding Twitter's SDKs for Android
Building Twitter's SDKs for Android
 
APIdays Helsinki 2019 - API Versioning with REST, JSON and Swagger with Thoma...
APIdays Helsinki 2019 - API Versioning with REST, JSON and Swagger with Thoma...APIdays Helsinki 2019 - API Versioning with REST, JSON and Swagger with Thoma...
APIdays Helsinki 2019 - API Versioning with REST, JSON and Swagger with Thoma...
 
Database Basics
Database BasicsDatabase Basics
Database Basics
 
Ben ford intro
Ben ford introBen ford intro
Ben ford intro
 
Telemetry doesn't have to be scary; Ben Ford
Telemetry doesn't have to be scary; Ben FordTelemetry doesn't have to be scary; Ben Ford
Telemetry doesn't have to be scary; Ben Ford
 

More from Caleb Jenkins

Code to DI For - Dependency Injection for Modern Applications
Code to DI For - Dependency Injection for Modern ApplicationsCode to DI For - Dependency Injection for Modern Applications
Code to DI For - Dependency Injection for Modern ApplicationsCaleb Jenkins
 
Scaling Scrum with UX in the Enterprise
Scaling Scrum with UX in the EnterpriseScaling Scrum with UX in the Enterprise
Scaling Scrum with UX in the EnterpriseCaleb Jenkins
 
Modern Web - MVP Testable WebForms
Modern Web - MVP Testable WebFormsModern Web - MVP Testable WebForms
Modern Web - MVP Testable WebFormsCaleb Jenkins
 
10 Reasons Your Software Sucks 2014 - Tax Day Edition!
10 Reasons Your Software Sucks 2014 - Tax Day Edition!10 Reasons Your Software Sucks 2014 - Tax Day Edition!
10 Reasons Your Software Sucks 2014 - Tax Day Edition!Caleb Jenkins
 
Modern ASP.NET Webskills
Modern ASP.NET WebskillsModern ASP.NET Webskills
Modern ASP.NET WebskillsCaleb Jenkins
 
Prototype Collaborate Innovate
Prototype Collaborate InnovatePrototype Collaborate Innovate
Prototype Collaborate InnovateCaleb Jenkins
 
10 Reasons Your Software Sucks - Election 2012 Edition
10 Reasons Your Software Sucks - Election 2012 Edition10 Reasons Your Software Sucks - Election 2012 Edition
10 Reasons Your Software Sucks - Election 2012 EditionCaleb Jenkins
 
Windows 8 & Phone 8 - an Architectural Battle Plan
Windows 8 & Phone 8 - an Architectural Battle PlanWindows 8 & Phone 8 - an Architectural Battle Plan
Windows 8 & Phone 8 - an Architectural Battle PlanCaleb Jenkins
 
Scaling Scrum with UX
Scaling Scrum with UXScaling Scrum with UX
Scaling Scrum with UXCaleb Jenkins
 
Scaling Scrum with UX
Scaling Scrum with UXScaling Scrum with UX
Scaling Scrum with UXCaleb Jenkins
 
Silverlight for Mobile World Dominations
Silverlight for Mobile World DominationsSilverlight for Mobile World Dominations
Silverlight for Mobile World DominationsCaleb Jenkins
 
.NET on the Cheap - Microsoft + OSS
.NET on the Cheap - Microsoft + OSS.NET on the Cheap - Microsoft + OSS
.NET on the Cheap - Microsoft + OSSCaleb Jenkins
 
10 practices that every developer needs to start right now
10 practices that every developer needs to start right now10 practices that every developer needs to start right now
10 practices that every developer needs to start right nowCaleb Jenkins
 
Threat Modeling - Writing Secure Code
Threat Modeling - Writing Secure CodeThreat Modeling - Writing Secure Code
Threat Modeling - Writing Secure CodeCaleb Jenkins
 
Dependency Injection in Silverlight
Dependency Injection in SilverlightDependency Injection in Silverlight
Dependency Injection in SilverlightCaleb Jenkins
 
Becoming A Presenter in the .NET World
Becoming A Presenter in the .NET WorldBecoming A Presenter in the .NET World
Becoming A Presenter in the .NET WorldCaleb Jenkins
 
Silverlight 2 with Visual Studio 2008 and Expression Blend
Silverlight 2 with Visual Studio 2008 and Expression BlendSilverlight 2 with Visual Studio 2008 and Expression Blend
Silverlight 2 with Visual Studio 2008 and Expression BlendCaleb Jenkins
 

More from Caleb Jenkins (20)

Coding Naked 2023
Coding Naked 2023Coding Naked 2023
Coding Naked 2023
 
Development Matters
Development MattersDevelopment Matters
Development Matters
 
Code to DI For - Dependency Injection for Modern Applications
Code to DI For - Dependency Injection for Modern ApplicationsCode to DI For - Dependency Injection for Modern Applications
Code to DI For - Dependency Injection for Modern Applications
 
Scaling Scrum with UX in the Enterprise
Scaling Scrum with UX in the EnterpriseScaling Scrum with UX in the Enterprise
Scaling Scrum with UX in the Enterprise
 
Modern Web - MVP Testable WebForms
Modern Web - MVP Testable WebFormsModern Web - MVP Testable WebForms
Modern Web - MVP Testable WebForms
 
10 Reasons Your Software Sucks 2014 - Tax Day Edition!
10 Reasons Your Software Sucks 2014 - Tax Day Edition!10 Reasons Your Software Sucks 2014 - Tax Day Edition!
10 Reasons Your Software Sucks 2014 - Tax Day Edition!
 
Modern ASP.NET Webskills
Modern ASP.NET WebskillsModern ASP.NET Webskills
Modern ASP.NET Webskills
 
Prototype Collaborate Innovate
Prototype Collaborate InnovatePrototype Collaborate Innovate
Prototype Collaborate Innovate
 
10 Reasons Your Software Sucks - Election 2012 Edition
10 Reasons Your Software Sucks - Election 2012 Edition10 Reasons Your Software Sucks - Election 2012 Edition
10 Reasons Your Software Sucks - Election 2012 Edition
 
Windows 8 & Phone 8 - an Architectural Battle Plan
Windows 8 & Phone 8 - an Architectural Battle PlanWindows 8 & Phone 8 - an Architectural Battle Plan
Windows 8 & Phone 8 - an Architectural Battle Plan
 
Scaling Scrum with UX
Scaling Scrum with UXScaling Scrum with UX
Scaling Scrum with UX
 
Coding Naked
Coding NakedCoding Naked
Coding Naked
 
Scaling Scrum with UX
Scaling Scrum with UXScaling Scrum with UX
Scaling Scrum with UX
 
Silverlight for Mobile World Dominations
Silverlight for Mobile World DominationsSilverlight for Mobile World Dominations
Silverlight for Mobile World Dominations
 
.NET on the Cheap - Microsoft + OSS
.NET on the Cheap - Microsoft + OSS.NET on the Cheap - Microsoft + OSS
.NET on the Cheap - Microsoft + OSS
 
10 practices that every developer needs to start right now
10 practices that every developer needs to start right now10 practices that every developer needs to start right now
10 practices that every developer needs to start right now
 
Threat Modeling - Writing Secure Code
Threat Modeling - Writing Secure CodeThreat Modeling - Writing Secure Code
Threat Modeling - Writing Secure Code
 
Dependency Injection in Silverlight
Dependency Injection in SilverlightDependency Injection in Silverlight
Dependency Injection in Silverlight
 
Becoming A Presenter in the .NET World
Becoming A Presenter in the .NET WorldBecoming A Presenter in the .NET World
Becoming A Presenter in the .NET World
 
Silverlight 2 with Visual Studio 2008 and Expression Blend
Silverlight 2 with Visual Studio 2008 and Expression BlendSilverlight 2 with Visual Studio 2008 and Expression Blend
Silverlight 2 with Visual Studio 2008 and Expression Blend
 

Recently uploaded

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

Taming the Monster Legacy Code Beast

  • 2. * Caleb * I’m here to help.
  • 3.
  • 4. Last year 10Reasons yoursoftwareSucks (and the 10 practicesto fix it)
  • 5. Building teams that engineer better software Development ∙ Team Work ∙ Process
  • 6. back to… Taming Legacy Code Monsters
  • 7. back to… Taming Legacy Code Monsters
  • 8. Definition “Legacy” n. Software that I’m afraid to maintain, extend, or change it actually scares me to touch that code.
  • 9. What’s the differencebetween an application and
  • 11. Legacy Monster Processor Static Config Static Proxy Processor Settings Data Connections Rules Configurations Coupling Coupling Coupling Coupling Coupling Rules Data Coupling
  • 12. Legacy Monster Solution contained over 68 projects. Most of which were notused. No horizontal layers. Required IIS 6 / legacy URL rewriter / 32 bit C Lib / IIS Rules export/import / Database Connections / Proper Configuration X 3 To run or test ANY part on a dev box…
  • 13. Strategy #1 Know your Foe
  • 15. Strategy #1 Visual Studio Dependency Graph
  • 16. Strategy #1 Demo Using theVisual Studio Dependency Graph
  • 17. Strategy #1 Demo Pro tip:Look for big blobs& thick linesto concrete types
  • 18. Strategy #2 Create aSafety Net
  • 19. Source Control+ Test Strategy #2
  • 20. Strategy #2 Source Control+ Test
  • 22. // source // svn / git / tfs .. // r1.1 // r1 // r2 // r3 // trunk // trunk Branching for FUN! //
  • 23. Strategy #2 Unit TestsIntegration Regression Load Tests Etc… Tests
  • 24. Isolation and White box Unit Testing for .NET Demo: Safety Net Legacy Monster “Pexautomatically generates test suites with high code coverage.…[and] finds interesting input-output values of your methods, which you can save as a small test suite with high code coverage. Microsoft Pex is a Visual Studio add-in for testing .NET Framework applications.” Processor Static Config Static IProxy Processor Settings Data Connections Rules Configurations http://research.microsoft.com/en-us/projects/pex/ Rules Data
  • 25. what about hard to test code? refactoring testability
  • 26. privateIList<Bean> goodBeans { get; set;} privateIList<Bean> badBeans { get; set;} publicvoidAddBean(Bean bean){ if(bean.size > 10) goodBeans.Add(bean); else badBeans.Add(bean); } publicvoidUpdateBeans(){ BeanData.Update(goodBeans); goodBeans.Clear(); badBeans.Clear(); }
  • 27. 1 Clearly an arbitrary example Does represent actual production code that I have worked with 2 3 AddBean(b); AddBean(b), UpdateBeans(); Usage scenario is How can we test the AddBean() Logic?
  • 28. publicIList<Bean> GoodBeans{ get; private set;} privateIlist <Bean>badBeans{ get; set;} publicvoidAddBean(Bean bean){ if(bean.size > 10) GoodBeans.Add(bean); else badBeans.Add(bean); } publicvoidUpdateBeans(){ BeanData.Update(goodBeans); GoodBeans.Clear(); badBeans.Clear(); } privateIList<Bean> goodBeans { get; set;} privateIList<Bean> badBeans { get; set;} publicvoidAddBean(Bean bean){ if(bean.size > 10) goodBeans.Add(bean); else badBeans.Add(bean); } publicvoidUpdateBeans(){ BeanData.Update(goodBeans); goodBeans.Clear(); badBeans.Clear(); } A: create a readonlyaccessor to “sense” thegoodBean state externally
  • 29. What about the UpdateBeans() method? publicvoidUpdateBeans(){ BeanData.Update(goodBeans); goodBeans.Clear(); badBeans.Clear(); } publicvoidUpdateBeans(){ BeanData.Update(goodBeans); goodBeans.Clear(); badBeans.Clear(); if (OnBeansUpdate != null) OnBeansUpdate(); } publiceventActionOnBeansUpdate;
  • 30. Code Coverage + Continuous Integration Not a silver bullet still need to make sure that we are testing “the right” things, and not just hitting some magical number still need to make sure we have healthy tests Pro tip
  • 31. Code Coverage + Continuous Integration Creates a base line or smoke test to look for Watch trends over magic percent numbers Pro tip
  • 32. Code Coverage + Continuous Integration Team City Code Coverage
  • 33. Code Coverage + Continuous Integration Sonar
  • 35. Strategy #3 Divide and Conquer (pick your battles)
  • 37. 37 Raise your hand and repeat after me, Commitment
  • 38. 38 Raise your hand and repeat after me, Commitment I will not practice bad code.
  • 39.
  • 41. “Resist Legacy Coupling” tight coupling = change anywhereaffects everything Legacy Monster Processor Static Config Static Proxy Processor Settings Data Connections Rules Configurations New Functionality Coupling Needs IProxy Coupling static Config class leads to Heavy Weight testing Coupling Coupling Coupling Rules Data don’t reference Config Monster Coupling use DI for only what you need (IProxy)
  • 42. Introduce SOLID principals on new development… gradually improve code over time http://developingux.com/di/
  • 44. Know your Foe wrap up Use a Safety Net Divide and Conquer
  • 45. Thank you! Proaction MentorS @calebjenkins http://developingux.com @proactionmentor caleb@proactionmentors.com
  • 46. Photo Credits © Michael Cummings - http://dreaminpictures.com http://www.flickr.com/photos/boogeyman13/2432667459/ http://www.flickr.com/photos/stopthegears/50553611/ http://www.flickr.com/photos/pochateca/324414459 http://www.flickr.com/photos/27620885@N02/2594362917
  • 47. http://www.flickr.com/photos/27620885@N02/2594363003 http://www.flickr.com/photos/flyingturtle/3976070342/ http://www.flickr.com/photos/jfravel/1001472806/ http://www.flickr.com/photos/flyingturtle/3976076272/ http://www.lostechies.com/blogs/derickbailey/archive/2009/02/11/solid-development-principles-in-motivational-pictures.aspx

Editor's Notes

  1. take a minute to have student “read” test and talk out what it’s doing.
  2. Build out slide.. Before you click through: take a minute to have student “read” test and talk out what it’s doing.