Legacy Code

Bringing Complex Legacy Software Under Control — C# Edition

Art for Legacy Code Check Out A Preview

By Mike Hill

Do you work with CRRAP: Code Requiring Remedial Attention Promptly? Legacy code is everywhere, so it helps to learn how to work with it effectively. Experience how experts use proven patterns to conquer legacy code challenges and then practice your skills on an extensive, real-world exercise.

Highlights

Legacy Strategies
Legacy Strategies: Tame your legacy code via expert strategies and guidance from genuine gurus. Learn more...
Expert Videos
Expert Videos: Learn tools & techniques by watching short videos from industry experts. Learn more...
Integrated Forums
Integrated Forums: Ask questions, get expert replies and read fascinating discussions. Learn more...

Includes

  • 4-6 hours of content
  • 93 pages
  • 6 Videos
  • 3 Exercises
  • Solution code and videos
  • Support for Visual Studio

Contents

You Are Here 3
What Is Legacy? 4
Why Care About Legacy? 5
The Top Three Activities With Legacy Code 6
Testability 7
Hurdles To Microtesting 8
How To Proceed? 9
A Chicken And Egg Problem? 10
The Legacy Stance 12
Element One: Stop Digging ← Click to Preview 13
Element Two: Start Stepping 14
Element Three: More Microtests! 15
Some Important Non-Technical Techniques 16
Developer Sign-off 17
Lunch and Learn (Study Group) 18
Lunch and Learn (Lottery) 19
The Big Visible Chart 20
Refactoring Budget 21
Now, Back To Your Regularly Scheduled Technique 22
Extract and Override: The Universal Pliers 24
The Context: An Awkward Chunk Of Code 25
The Technique: Isolate And Test Around 26
Diagrams 27
How Much Code To Extract? ← Click to Preview 28
Why You Should NOT Use Extract And Override 29
Why You SHOULD Use Extract And Override 30
Order Processing 32
Download Starting Code 33
Investigation Time 34
Make OrderTest Fast! 35
Extract And Override Solution ← Click to Preview 36
Welcome To CRRAP! 38
A Typical Piece of CRRAP 39
Brief Overview Of The Output 40
The Cheat Sheet 41
The Rules Of The Game 42
Start with the Universals 44
Step 1: Reformat and Commit 45
Step 1: Our Version 46
Step 2: Eliminate the Noise 47
Step 2: Our Version 48
Step 3: Get To Testability 49
Crazy Mike Hits A Dead End! 50
Legacy Pattern: Mini-Scoop It! 51
Legacy Pattern: Maxi-Scoop 52
Legacy Pattern: Tests As Probes 53
Pindown Tests 54
Exercise: Pin Down One Path 55
Where to from here? 57
The Mission ← Click to Preview 58
Technique: Control Your Namespace ← Click to Preview 59
Technique: Think Small 60
Technique: Keep Tests Excellent ← Click to Preview 61
The Cheat Sheet Again 62
Getting Started 63
Hints Page 64
Hints Page 2 65
What is Static Cling? 67
A Class With Static Variables 68
Unexpected Test Failure 69
A Bad Solution: Reset Shared Data 70
A Better Solution: Remove Side-Effects 71
Creation Complexity 72
Solution: A Factory 73
Exercise: Static Cling 75
Problems! 76
A Close Look At The SongPlayer Class 77
Test Failures 78
Different Failures? 79
Download The Code 80
Your Mission 81
Our Solution 82
What About Privates? 84
How Interesting Are Privates? 85
If They Are Not Interesting, Don't Bother Testing Them 86
Ease the Restriction 87
How Private Are Privates? 88
Test Derived Class 89
The Refactoring Approach: Extract a Helper Class ← Click to Preview 90
Privates, Design, And Testability 91
Conclusion: Where to Next? 93

Related Items

Volume Licensing

Have Any Questions?

Highlights

Legacy Strategies
Legacy Strategies: Tame your legacy code via expert strategies and guidance from genuine gurus. Learn more...
Expert Videos
Expert Videos: Learn tools & techniques by watching short videos from industry experts. Learn more...
Integrated Forums
Integrated Forums: Ask questions, get expert replies and read fascinating discussions. Learn more...

Includes

  • 4-6 hours of content
  • 93 pages
  • 6 Videos
  • 3 Exercises
  • Solution code and videos
  • Support for Visual Studio

Contents

You Are Here 3
What Is Legacy? 4
Why Care About Legacy? 5
The Top Three Activities With Legacy Code 6
Testability 7
Hurdles To Microtesting 8
How To Proceed? 9
A Chicken And Egg Problem? 10
The Legacy Stance 12
Element One: Stop Digging ← Click to Preview 13
Element Two: Start Stepping 14
Element Three: More Microtests! 15
Some Important Non-Technical Techniques 16
Developer Sign-off 17
Lunch and Learn (Study Group) 18
Lunch and Learn (Lottery) 19
The Big Visible Chart 20
Refactoring Budget 21
Now, Back To Your Regularly Scheduled Technique 22
Extract and Override: The Universal Pliers 24
The Context: An Awkward Chunk Of Code 25
The Technique: Isolate And Test Around 26
Diagrams 27
How Much Code To Extract? ← Click to Preview 28
Why You Should NOT Use Extract And Override 29
Why You SHOULD Use Extract And Override 30
Order Processing 32
Download Starting Code 33
Investigation Time 34
Make OrderTest Fast! 35
Extract And Override Solution ← Click to Preview 36
Welcome To CRRAP! 38
A Typical Piece of CRRAP 39
Brief Overview Of The Output 40
The Cheat Sheet 41
The Rules Of The Game 42
Start with the Universals 44
Step 1: Reformat and Commit 45
Step 1: Our Version 46
Step 2: Eliminate the Noise 47
Step 2: Our Version 48
Step 3: Get To Testability 49
Crazy Mike Hits A Dead End! 50
Legacy Pattern: Mini-Scoop It! 51
Legacy Pattern: Maxi-Scoop 52
Legacy Pattern: Tests As Probes 53
Pindown Tests 54
Exercise: Pin Down One Path 55
Where to from here? 57
The Mission ← Click to Preview 58
Technique: Control Your Namespace ← Click to Preview 59
Technique: Think Small 60
Technique: Keep Tests Excellent ← Click to Preview 61
The Cheat Sheet Again 62
Getting Started 63
Hints Page 64
Hints Page 2 65
What is Static Cling? 67
A Class With Static Variables 68
Unexpected Test Failure 69
A Bad Solution: Reset Shared Data 70
A Better Solution: Remove Side-Effects 71
Creation Complexity 72
Solution: A Factory 73
Exercise: Static Cling 75
Problems! 76
A Close Look At The SongPlayer Class 77
Test Failures 78
Different Failures? 79
Download The Code 80
Your Mission 81
Our Solution 82
What About Privates? 84
How Interesting Are Privates? 85
If They Are Not Interesting, Don't Bother Testing Them 86
Ease the Restriction 87
How Private Are Privates? 88
Test Derived Class 89
The Refactoring Approach: Extract a Helper Class ← Click to Preview 90
Privates, Design, And Testability 91
Conclusion: Where to Next? 93

Related Items