# Indiana Jones and the Temple of Legacy Code - William Brander - NDC Oslo 2026

## Executive summary

This talk uses the metaphor of Indiana Jones and ancient traps to guide developers through the process of safely modernizing legacy codebases. The core argument is that dealing with legacy systems requires a structured approach focused on improving 'Supportability' (tooling and safety nets) and 'Understanding' (archaeology and history). Key strategies include establishing reproducible builds, implementing comprehensive testing (including mutation testing), adding observability, and using advanced source control analysis (like `git log` queries) to map hidden dependencies and understand historical decisions.

## Key takeaways

- The Legacy System Quadrant: Assess the system's state using two axes: Understanding (how well you know the code) and Supportability (the tooling around the code, e.g., tests, CI, observability). The goal is to move the system from the low-understanding/low-supportability quadrant to the high-understanding/high-supportability ideal state. (Timestamp: 1260)
- Improving Supportability: To make changes safely, establish reproducible builds, pin specific dependency versions, remove machine-specific build requirements, and integrate the system into a CI pipeline with rollback capabilities. (Timestamp: 1630)
- Advanced Code Archaeology: Use source control tools (like `git log` queries) to analyze historical data. Look for files with high change counts, frequent bug fixes, or high churn percentage to identify critical, yet poorly understood, components. (Timestamp: 2050)
- Life Cycle Determines Technique: The appropriate refactoring technique depends on the system's life cycle: Critical Support Only (prefer adding new behavior, e.g., `getSortedItemValueNames`), General Maintenance (change at the edge), or Active Development (slice by capability). (Timestamp: 2700)

## Technical details

- Legacy System Analysis Framework: The system state is defined by: 1) Understanding (predicting impact of changes); 2) Supportability (builds, tests, CI, observability, rollbacks); and 3) Life Cycle (Critical Support, General Maintenance, Active Development). (Timestamp: 1260)
- Testing and AI Integration: Implement unit, integration, and acceptance tests. Use mutation testing (e.g., Striker.net for .NET) to ensure tests are meaningful by having the framework intentionally break the code to prove test coverage. AI agents can assist in generating these tests. (Timestamp: 1800)
- Observability and Mapping: Add observability (e.g., using OpenTelemetry) for simple flows first (like user login) to establish telemetry in production. This allows developers to create a visual map of the system's flow and understand component interactions. (Timestamp: 2150)
- Source Control Querying: Treat the Git repository as a database. Use `git log` queries to select and group data (e.g., files changed most often, files with the highest churn percentage) to identify areas needing investigation. (Timestamp: 2050)
- Refactoring Techniques: When making changes, prioritize non-invasive techniques: 'Adding' new functionality (e.g., `getSortedItemValueNames`) over modifying existing methods. Alternatively, 'Change at the Edge' or 'Slice by Capability' can isolate changes to minimize risk. (Timestamp: 2700)

## Practical implications

- When inheriting a legacy system, immediately focus on establishing reproducible build processes and pinning dependency versions to stabilize the environment.
- Do not attempt large, sweeping refactors initially. Instead, use observability and targeted testing to build a map of the system's boundaries and dependencies.
- When making changes, always evaluate the system's current life cycle (Critical Support vs. Active Development) to determine the safest technique (e.g., adding a new method vs. modifying an old one).
- Use advanced source control queries to find 'hot spots'—files with high churn or frequent bug fixes—and treat these areas with extreme caution.

## Topics

Legacy Code Management, Software Architecture, Build Engineering, Source Control Archaeology, Refactoring Patterns, Observability, Jellyfin, CodeScene, CodeMart, Striker.net

Source: https://www.youtube.com/watch?v=d7XCVocFKws
