Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Digging into the Matrix: Practicing Code Archae...

Digging into the Matrix: Practicing Code Archaeology

Most of the code that exists in the world is code you didn’t write, and so most of the code you work with is also code you didn’t write, even if you’re not working with a legacy system. But when we don’t understand that code, we can all too often dismiss, disparage, or even simply delete it - and that’s a mistake!

Almost all the code we interact with was written by other humans, and they wrote the code that way for a reason. If we take the time to understand the context and the story behind a piece of code, we can infer a lot about what those humans meant to achieve, what their culture was like, and what they valued… in other words, we need to become an archaeologist!

Let’s work to build a better understanding of the code we didn’t write, and of who wrote it and why. Using the tools of psychology you can learn what’s happening to your brain when you’re reading someone else’s code, and then learn how you can make understanding it take less cognitive effort. Using the tools of archaeology you can learn how to use your development environment to find the real stories of the people that wrote it, and how that story can protect you from making the same mistakes they did. The ability to read and examine others’ code is essential - you can’t change or improve software without understanding what it already does, so come learn how to do it with skill and compassion!

==Resources==
Gratitude journaling -
https://greatergood.berkeley.edu/article/item/tips_for_keeping_a_gratitude_journal

User roles research -
Just Enough Research, Erika Hall
https://www.nngroup.com/articles/personas-study-guide/
https://jobs-to-be-done.com/jobs-to-be-done-a-framework-for-customer-needs-c883cbf61c90
https://www.nngroup.com/articles/journey-mapping-101/

Reading Code -
The Programmer's Brain, Felienne Hermans

Execution Flow Diagrams -
https://dev.to/conw_y/visualising-execution-flows-59e7

Branching Patterns -
https://martinfowler.com/articles/branching-patterns.html

Parkinson's First Law -
https://en.wikipedia.org/wiki/Parkinson%27s_law

Refactoring -
Emily Bache’s Refactoring Guided Learning, https://www.youtube.com/watch?v=K7xSsNpeM8I
Refactoring, Martin Fowler
Working Effectively with Legacy Code, Michael C Feathers
Refactoring to Patterns, Joshua Kerievsky

Avatar for Arthur Doler

Arthur Doler

May 13, 2025
Tweet

More Decks by Arthur Doler

Other Decks in Programming

Transcript

  1. @arthurdoler.com Arthur Doler Resources: Boring details about me are at

    https://arthurdoler.com Arthur Doler Resources: @arthurdoler.com https://bit.ly/art-digging-into-the-matrix Boring details about me are at https://arthurdoler.com
  2. @arthurdoler.com Mindset – Curiosity, Empathy, and Chesterton’s Fence vs the

    Monkey Ladder Surveying – Exploring the Hourglass Excavation – The History and the Strata Analysis – Writing the Historical Play Progression – What’s Next? How to practice code archaeology at work So let’s crack in!
  3. @arthurdoler.com Who wrote it? Why did they do it? Why

    did they do it the way they did it? What’s the story of the writing of the code? What’s the story of the code after it was written? If you can get accurate, concrete answers to these, you will own the world
  4. @arthurdoler.com “Regardless of what we discover, we understand and truly

    believe that everyone did the best job they could, given what they knew at the time, their skills and abilities, the resources available, and the situation at hand.” — Agile Prime Directive Kerth, Project Retrospectives: A Handbook for Team Reviews, 2001
  5. @arthurdoler.com IF YOU WANT TO BOOST YOUR EMPATHY, YOU CAN

    START WITH GRATITUDE https://greatergood.berkeley.edu/article/item/tips_for_keeping_a_gratitude_journal
  6. @arthurdoler.com What was it created to achieve? What types of

    humans use it? What are their roles? What are the goals of each role that uses the system? Wait a sec, this looks familiar…
  7. @arthurdoler.com What are its parts? Where do they run? What

    are they written in/with/on? Which parts talk with which other parts? How are those parts built? How are they delivered? More questions than average for one of my talks.
  8. @arthurdoler.com Lesson 1: Chunking Lesson 2: Refactor and document as

    you go Lesson 3: Replace unfamiliar language construct There are hours worth of content in this book alone!
  9. @arthurdoler.com Lesson 1: Chunking Lesson 2: Refactor and document as

    you go Lesson 3: Replace unfamiliar language constructs Make sure you do the exercises. Don’t just read it.
  10. @arthurdoler.com @arthurdoler.com “I don’t even see the code. All I

    see is box, arrow, box, arrow, cylinder…”
  11. @arthurdoler.com VISUALIZATION TOOLS CAN LET YOU EASILY EXPLORE THE CHANGES

    OVER TIME I’m a better developer on the CLI but a better detective with a GUI.
  12. @arthurdoler.com Hate to be the one to tell you this,

    but externalities affect your codebase
  13. @arthurdoler.com Pay attention to how a tool tells you to

    use it, and you can see its effects.
  14. @arthurdoler.com ASP / VB.NET Backbone / Marionette Javascript / React

    / Redux Typescript / React / React-Query Wake up, new version of the four humours just dropped
  15. @arthurdoler.com What resources did the team have? What resources did

    they lack? What strata is the code from? What now-commonplace solutions and processes didn’t exist then? What were the organizational rules and processes? What other projects were going on? More questions for your dollar than any other talk!
  16. @arthurdoler.com ONCE YOU UNDERSTAND WHY THE CODE IS THE WAY

    IT IS… IT’S EASIER TO UNDERSTAND HOW TO CHANGE IT! This is it, this is the lesson it’s taken me decades to learn well.
  17. @arthurdoler.com If the previous code was constrained, are those constraints

    gone? If the code was affected by similarity to previous code, should it have been similar? Was the person’s intent incorrect? What strata is the code from? Without all the previous work, you’ll be totally guessing here.
  18. @arthurdoler.com Refactoring is a surprisingly deep topic and one I

    enjoy reading about. Emily Bache’s Refactoring Guided Learning – https://www.youtube.com/watch?v=K7xSsNpeM8I Refactoring – Martin Fowler Working Effectively with Legacy Code – Michael C Feathers Refactoring to Patterns – Joshua Kerievsky
  19. @arthurdoler.com MINDSET •Remember Chesterton’s Fence and the Monkey Ladder, and

    start closer to Chesterton’s Fence. •Build your curiosity daily. •Practice empathy towards those who wrote the code. Start with your internals…
  20. @arthurdoler.com SURVEYING •Start with one user goal and work through

    the Hourglass: •The Humans, •The System, •The Code, •…and back up. …move on to the state of the world…
  21. @arthurdoler.com EXCAVATION •Find the forces that shaped the code’s construction.

    •Look through all the histories available to you. •…and opinionated external libraries, too. •Establish strata when the System’s long-lived enough … dig back into the past…
  22. @arthurdoler.com PROGRESSION •Recontextualize based on your own goal •Should you

    rewrite or just refactor? •Use the story to guide your next steps •Write down what you found …and move forward.
  23. @arthurdoler.com Arthur Doler My website is probably still https://arthurdoler.com Resources:

    THANKS FOR LISTENING! https://bit.ly/art-digging-into-the-matrix