Refactoring at Scale: Regaining Control of Your Codebase
Making significant changes to large, complex codebases is a daunting task—one that's nearly impossible to do successfully unless you have the right team, tools, and mindset. If your application is in need of a substantial overhaul and you're unsure how to go about implementing those changes in a sustainable way, then this book is for you.

Software engineer Maude Lemaire walks you through the entire refactoring process from start to finish. You'll learn from her experience driving performance and refactoring efforts at Slack during a period of critical growth, including two case studies illustrating the impact these techniques can have in the real world. This book will help you achieve a newfound ability to productively introduce important changes in your codebase.

  • Understand how code degrades and why some degradation is inevitable
  • Quantify and qualify the state of your codebase before refactoring
  • Draft a well-scoped execution plan with strategic milestones
  • Win support from engineering leadership
  • Build and coordinate a team best suited for the project
  • Communicate effectively inside and outside your team
  • Adopt best practices for successfully executing the refactor
1137066907
Refactoring at Scale: Regaining Control of Your Codebase
Making significant changes to large, complex codebases is a daunting task—one that's nearly impossible to do successfully unless you have the right team, tools, and mindset. If your application is in need of a substantial overhaul and you're unsure how to go about implementing those changes in a sustainable way, then this book is for you.

Software engineer Maude Lemaire walks you through the entire refactoring process from start to finish. You'll learn from her experience driving performance and refactoring efforts at Slack during a period of critical growth, including two case studies illustrating the impact these techniques can have in the real world. This book will help you achieve a newfound ability to productively introduce important changes in your codebase.

  • Understand how code degrades and why some degradation is inevitable
  • Quantify and qualify the state of your codebase before refactoring
  • Draft a well-scoped execution plan with strategic milestones
  • Win support from engineering leadership
  • Build and coordinate a team best suited for the project
  • Communicate effectively inside and outside your team
  • Adopt best practices for successfully executing the refactor
65.99 In Stock
Refactoring at Scale: Regaining Control of Your Codebase

Refactoring at Scale: Regaining Control of Your Codebase

by Maude Lemaire
Refactoring at Scale: Regaining Control of Your Codebase

Refactoring at Scale: Regaining Control of Your Codebase

by Maude Lemaire

Paperback

$65.99 
  • SHIP THIS ITEM
    In stock. Ships in 1-2 days.
  • PICK UP IN STORE

    Your local store may have stock of this item.

Related collections and offers


Overview

Making significant changes to large, complex codebases is a daunting task—one that's nearly impossible to do successfully unless you have the right team, tools, and mindset. If your application is in need of a substantial overhaul and you're unsure how to go about implementing those changes in a sustainable way, then this book is for you.

Software engineer Maude Lemaire walks you through the entire refactoring process from start to finish. You'll learn from her experience driving performance and refactoring efforts at Slack during a period of critical growth, including two case studies illustrating the impact these techniques can have in the real world. This book will help you achieve a newfound ability to productively introduce important changes in your codebase.

  • Understand how code degrades and why some degradation is inevitable
  • Quantify and qualify the state of your codebase before refactoring
  • Draft a well-scoped execution plan with strategic milestones
  • Win support from engineering leadership
  • Build and coordinate a team best suited for the project
  • Communicate effectively inside and outside your team
  • Adopt best practices for successfully executing the refactor

Product Details

ISBN-13: 9781492075530
Publisher: O'Reilly Media, Incorporated
Publication date: 11/17/2020
Pages: 243
Product dimensions: 7.00(w) x 9.19(h) x 0.52(d)

About the Author

Maude Lemaire is a software engineer at Slack where she works to scale the product to support some of the world’s largest organizations. She spends most of her time chasing down people making network calls in a loop, refactoring unwieldy chunks of code, consolidating redundant database schemas, and building tools for other developers. Maude cares deeply about the developer experience and has actively sought out simpler, more efficient ways to structure code in each of her roles, at all levels of the stack.

Maude obtained a BSc. in Honours Software Engineering from McGill University.

Table of Contents

Preface ix

Part I Introduction

1 Refactoring 3

What Is Refactoring? 4

What Is Refactoring at Scale? 6

Why Should You Care About Refactoring? 8

Benefits of Refactoring 9

Developer Productivity 9

Identifying Bugs 10

Risks of Refactoring 11

Serious Regressions 11

Unearthing Dormant Bugs 12

Scope Creep 12

Unnecessary Complexity 12

When to Refactor 13

Small Scope 13

Code Complexity Actively Hinders Development 13

Shift in Product Requirements 14

Performance 14

Using a New Technology 15

When Not to Refactor 16

For Fun or Out of Boredom 16

Because You Happened to Be Passing By 16

To Making Code More Extendable 18

When You Don't Have Time 18

Our First Refactoring Example 18

Simplifying Conditionals 21

Extracting Magic Numbers 22

Extracting Self-Contained Logic 23

2 How Code Degrades 27

Why Understanding Code Degradation Matters 28

Requirement Shifts 29

Scalability 29

Accessibility 30

Device Compatibility 30

Environmental Changes 31

External Dependencies 32

Unused Code 32

Changes in Product Requirements 33

Tech Debt 35

Working Around Technology Choices 35

Persistent Lack of Organization 39

Moving Too Quickly 40

Applying Our Knowledge 41

Part II Planning

3 Measuring Our Starting State 45

Why Is Measuring the Impact of a Refactor Difficult? 46

Measuring Code Complexity 47

Halstead Metrics 47

Cyclomatic Complexity 50

NPath Complexity 53

Lines of Code 55

Test Coverage Metrics 57

Documentation 60

Formal Documentation 61

Informal Documentation 62

Version Control 64

Commit Messages 64

Commits in Aggregate 65

Reputation 66

Building a Complete Picture 69

4 Drafting a Plan 71

Defining Your End State 72

On the Road 72

At Work 72

Mapping the Shortest Distance 74

On the Road 74

At Work 75

Identifying Strategic Intermediate Milestones 76

On the Road 77

At Work 77

Choosing a Rollout Strategy 80

Dark Mode/Light Mode 81

Smart DNA's Rollout 86

Cleaning Up Artifacts 87

Referencing Metrics in Your Plan 88

Interpolating Goal Metrics to Intermediate Milestones 89

Distinct Milestone Metrics 89

Estimating 90

Sharing Your Plan with Other Teams 91

Transparency 92

Perspective 92

Refined Plan 94

5 Getting Buy-In 97

Why Your Manager Is Not Onboard 98

Managers Aren't Coding 98

Managers Are Evaluated Differently 99

Managers See the Risk 99

Managers Need to Coordinate 100

Strategies for Making a Compelling Argument 101

Using Conversational Devices 102

Building an Alignment Sandwich 104

Relying on Evidence 107

Playing Hardball 108

Buy-In Shapes the Refactor 109

6 Building the Right Team 111

Identifying Different Kinds of Experts 112

Matchmaking 113

Experts of Many Trades 115

Revisiting Active Contributors 115

Biases in Our Expert List 116

Types of Refactoring Teams 117

Owners 117

Proposed Approach 119

Cleanup Crews 120

The Pitch 122

Metrics 123

Generosity 124

Opportunity 124

Bartering 125

Repeat 126

A Few Outcomes 126

Realistic Scenario 127

Worst-Case Scenario 127

Fostering Strong Teams 128

Part III Execution

7 Communication 131

Within Your Team 132

Stand-Ups 133

Weekly Syncs 135

Retrospectives 137

Outside Your Team 138

When Kicking Off the Project 138

During Project Execution 141

Always Iterate 146

8 Strategies for Execution 147

Team Building 147

Pair Programming 148

Keeping Everyone Motivated 150

Keeping a Tally 152

Intermediate Metric Measurements 152

Unearthed Bugs 153

Clean-Up Items 154

Out-of-Scope Items 154

Programming Productively 155

Prototyping 155

Keep Things Small 156

Test, Test, Test 157

Asking the "Stupid" Question 157

Conclusion 158

9 Making the Refactor Stick 159

Fostering Adoption 160

Education 161

Active Education 161

Passive Education 164

Reinforcement 165

Progressive Linting 165

Code Analysis Tools 166

Gates Versus Guardrails 166

Integrating Improvement into the Culture 167

Part IV Case Studies

10 Case Study: Redundant Database Schemas 171

Slack 101 172

Slack Architecture 101 174

Scalability Problems 177

Booting Up the Slack Client 177

File Visibility 178

Mentions 178

Consolidating the Tables 180

Gathering the Scattered Queries 181

Developing a Migration Strategy 183

Quantifying Our Progress 186

Attempting to Keép the Team Motivated 187

Communicating Our Progress 188

Tidying Up 190

Lessons Learned 192

Develop a Well-Defined, Well-Communicated Plan 192

Understand the Code's History 193

Ensure Adequate Test Coverage 194

Keep Your Team Motivated 194

Focus on Strategic Milestones 195

Identify and Rely on Meaningful Metrics 195

Takeaways 196

11 Case Study: Migrating to a New Database 197

Workspace-Sharded Data 198

Migrating channels_members to Vitess 199

Sharding Scheme 200

Developing a New Schema 201

Detangling JOINs 203

A Difficult Rollout 208

Backfill Mode 209

Dark Mode 210

Light Mode 215

Sunset Mode 216

Tidying Up 217

Lessons Learned 219

Set Realistic Estimates 219

Source the Teammates You Need 220

Plan Scope Carefully 220

Choose a Single Place for Project Communication 221

Design a Thoughtful Rollout Plan 221

Takeaways 222

Index 223

From the B&N Reads Blog

Customer Reviews