BoreNO

How to Refactor Legacy Codebases Safely Without Breaking Tests

Designed for Senior backend engineers responsible for maintaining and evolving enterprise-level legacy systems with extensive automated test suites. to spark real collaboration and high-energy learning.

A 90-minute, in-person workshop for engineers at a large financial services company. The group is under pressure to modernize a sprawling, business-critical Java codebase, but past refactoring has caused intermittent test failures and production bugs, eroding confidence in changes.

Icebreaker
Activity 1

Legacy Detective: Codebase Time Capsule

Participants are given a printed snippet from a real, convoluted method in their codebase—with variable names changed. In small groups, they guess the code’s purpose and potential risks. Debrief by revealing the code’s actual function and production impact.

Tap to view the full activity.

Why this works

This triggers curiosity and primes the brain for pattern recognition by reframing familiar code as a puzzle. It lowers emotional defenses by making the 'old code' a shared mystery, not a source of blame.

Icebreaker
Activity 2

Test Safety Myths: Fact or Fiction?

Facilitator presents 3 statements about test coverage and refactoring safety (e.g., '100% test coverage guarantees safe refactoring'). Participants vote ‘Fact’ or ‘Fiction’ via colored cards, then discuss the real implications and limitations behind each.

Tap to view the full activity.

Why this works

By surfacing common misconceptions, you flush out silent assumptions and create space for nuanced understanding—key to expertise development.

Icebreaker
Activity 3

Safe Refactoring Speed Round

Invite volunteers to call out one safe, ‘baby-step’ refactoring (e.g., renaming a variable, extracting a method) they’ve used, while the facilitator rapidly records them on a whiteboard. No judgment—just a round-robin to build psychological safety and a toolkit.

Tap to view the full activity.

Why this works

Low-pressure group share normalizes small, incremental changes and builds a collective sense of practical next steps. Quick-fire style keeps anxiety low.

Icebreaker
Activity 4

Refactor Relay: Live Code Challenge

Two teams compete to safely refactor the same short, gnarly method (projected onto a screen). Each team alternates proposing their next step, but after every move, the facilitator runs the test suite—if it fails, the team must justify and fix their change.

Tap to view the full activity.

Why this works

Injecting energy and time pressure, this makes technical skill-building social and fun, while reinforcing the discipline of constant feedback (test runs) during refactoring.

Icebreaker
Activity 5

When Tests Break: Stakeholder Dilemma

Present a case: During refactoring, a critical integration test fails intermittently, blocking deployment. Participants break into stakeholder-role groups (engineer, QA, manager, product owner) to strategize: patch the test, revert code, or ship with a waiver? Groups present their reasoning.

Tap to view the full activity.

Why this works

Facing a real-world dilemma requires participants to balance technical purity with business pressure—deepening empathy and practical judgment.

Icebreaker
Activity 6

Failure Postcard: Lessons to My Future Self

Each participant writes a ‘postcard’ to their future self, describing the ugliest legacy refactor they survived and what they wish they’d known. Volunteers read their postcards aloud, surfacing both emotion and wisdom.

Tap to view the full activity.

Why this works

This cements learning through storytelling and reflection, reframing painful experiences as sources of confidence and growth.

Sign up to unlock 3 more activities

Get the full pack, facilitation flow, and more ready-to-run ideas.

Sign up with email