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

Reversible Decisions for Better Software Design...

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →

Reversible Decisions for Better Software Design (VoxxedDays Zürich)

Avatar for David Tanzer

David Tanzer

March 25, 2026

More Decks by David Tanzer

Other Decks in Technology

Transcript

  1. Today • Easy to Change vs. Hard to Change •

    Design Decisions to Make Changes Easier • MMMSS • Feedback • Refactoring • What about AI? @[email protected] - @dtanzer.bsky.social 2
  2. Non-Solution: Branching It just delays the point at which you

    have to deal with the problem! @[email protected] - @dtanzer.bsky.social 3
  3. • A Spectrum of Decisions • Why are Things Hard

    to Change? • Reversible Structure Changes @[email protected] - @dtanzer.bsky.social Easy to Change vs. Hard to Change 4
  4. Why are Things Hard to Change? • Changes break functionality

    • Multiple changes in different parts of the code required • Every change requires more changes • Coupling ◦ But: Can we prevent all coupling? @[email protected] - @dtanzer.bsky.social 10
  5. Reversible Structure Changes • Haircut vs. Tattoo ◦ vs. cutting

    your arm off! • In general, we should treat reversible decisions differently than irreversible decisions --Kent Beck, "Tidy First", p. 75 @[email protected] - @dtanzer.bsky.social 11
  6. Reversible Structure Changes When changes are reversible (and quick to

    implement), we can just try to make them without planning or thinking too much! @[email protected] - @dtanzer.bsky.social 12
  7. Two Cases • Change a decision that was already made

    ◦ First, make the change easy, then make the easy change (Kent Beck) • Implement a decision you might need to change later ◦ Any decision! ◦ Can you make future changes easier? @[email protected] - @dtanzer.bsky.social 13
  8. • Coupling and Cohesion • Inside vs. Outside • Contain

    the Damage • SOLID / CUPID • Techniques fom DDD • Attractive Code • Options • Feature Flags @[email protected] - @dtanzer.bsky.social Design Decisions to Make Changes Easier 14
  9. Coupling and Cohesion • to couple: to join or combine

    • In software development coupling is the degree of interdependence between software modules • to cohere: to unite or to hold together as a unit • In software development: cohesion refers to the degree to which the elements inside a module belong together @[email protected] - @dtanzer.bsky.social 15
  10. Universal Architecture • Happy zone: In-memory, fast, domain-driven, no concurrency,

    ... • DMZ translates and protects • Interfaces to happy zone are well-designed ◦ AND are part of the happy zone • Keep DMZ as thin as possible • Code flows from DMZ to happy zone • cf. Ports and adapters, onion architecture, clean architecture J.B. Rainsberger @[email protected] - @dtanzer.bsky.social 22
  11. Contain the Damage • Define interfaces that are error boundaries

    ◦ Validate all data going across ◦ Do not pass on errors ◦ cf. Circuit breaker pattern • Define interfaces that stop code ripples ◦ Beware of shared code or data structures here • Micro services or modular monoliths • cf. "Breakwater Technique" by GeePaw Hill @[email protected] - @dtanzer.bsky.social 28
  12. SOLID • Single Responsibility Principle • Open / Closed Principle

    • Liskov Substitution Principle • Interface Segregation Principle • Dependency Inversion Principle Robert C. Martin CUPID • Composable • Unix Philosophy • Predictable • Idiomatic • Domain-based Daniel Terhorst-North @[email protected] - @dtanzer.bsky.social 29
  13. Attractive Code When I introduce a ValueObject, I expect it

    to become "attractive code", meaning literally a class/module that attracts behavior towards it as new methods/functions. --J.B. Rainsberger @[email protected] - @dtanzer.bsky.social 30
  14. Techniques fom DDD • Bounded Context • Relationship between contexts

    ◦ Equal ◦ Upstream / Downstream ◦ Separate Ways • Open Host Service vs. Consumer Driven Contracts • Contain the damage ◦ Anti Corruption Layer @[email protected] - @dtanzer.bsky.social 31
  15. Options Anything you can do without the obligation to do

    it is a real option. --Maassen/Matts/Geary, "Commitment", p. 59 • Options have value ◦ The value of the benefit ◦ AND the value of the fact that you can still decide • Options expire • Never commit early unless you know why @[email protected] - @dtanzer.bsky.social 32
  16. • The Sortest Distance • Intrinsic Benefit of Steps •

    Reversibility of a Step vs. the Chain • How to Apply @[email protected] - @dtanzer.bsky.social MMMSS 34
  17. The Sortest Distance In software engineering, it's usually not a

    straight line! • You can only find the real path by taking small steps ◦ and getting feedback ◦ and adjusting @[email protected] - @dtanzer.bsky.social 40
  18. Intrinsic Benefit of Steps • Steerability • Interruptability • Reversibility

    • ...others... GeePaw Hill, Intrinsic Benefits of Steps • Faster feedback = more value, sooner @[email protected] - @dtanzer.bsky.social 41
  19. How to Apply • Work in small steps • Get

    feedback, adjust • Keep the chain reversible @[email protected] - @dtanzer.bsky.social 43
  20. • Contain the Damage! • Getting Feedback Faster • Static

    Analysis • TDD • Approval Tests @[email protected] - @dtanzer.bsky.social Feedback 44
  21. Contain the Damage! Feedback helps to contain the damage in

    the time dimension. Find out sooner when you have to reverse a change. @[email protected] - @dtanzer.bsky.social 45
  22. TDD How does that help with reversible decisions? • Tests

    as safety net • Tests as thinking aid • Tests that verify safe interfaces • Further risk reduction: BDD, Double-Loop TDD, Agile Acceptance Testing, ... @[email protected] - @dtanzer.bsky.social 52
  23. Approval Tests • Automate some action in the system under

    test • Record the results • Test fails if results changed ◦ Manually accept or reject new result @[email protected] - @dtanzer.bsky.social 53
  24. • What is It / What Not? • Series of

    Safe Steps: MMMSS • Confidence: No Behavior Change • How does That Help? @[email protected] - @dtanzer.bsky.social Refactoring 54
  25. What is It / What Not? A change made to

    the internal structure of the software to make it easier to understand and cheaper to modify without changing its observable behavior -- Martin Fowler • Feature-for-feature and bug-for-bug compatible • How can we know we have not changed anything? @[email protected] - @dtanzer.bsky.social 55
  26. Series of Safe Steps: MMMSS • Many small changes •

    Automate as much as possible • Use provable refactoring • Validate every step @[email protected] - @dtanzer.bsky.social 56
  27. How does That Help? • Getting better at refactoring enables

    reversible decisions • Refactoring is a skill ◦ Can be learned ◦ Needs to be practiced @[email protected] - @dtanzer.bsky.social 58
  28. • Tragedy of the Commons • How can AI help?

    • Refactoring with AI • How does AI benefit? @[email protected] - @dtanzer.bsky.social What about AI? 59
  29. Tragedy of the Commons (not really) • (Unpopular?) Opinion: AI

    is a net negative for humanity. • -but- • Not using it comes with risks and drawbacks ◦ Especially if you are the only one not using it • Using it is probably unethical • Not using it is probably unethical too https://en.wikipedia.org/wiki/Tragedy_of_the_commons @[email protected] - @dtanzer.bsky.social 60
  30. How can AI help? • Very good at reviewing the

    impact of a change ◦ "Did this code change alter behavior?" ◦ "Did this code change impact performance?" • Good at analyzing code ◦ Architecture / Design ◦ Code Smells • OK / Not completely bad at coming up with a series of small steps @[email protected] - @dtanzer.bsky.social 61
  31. Refactoring with AI • AI does not refactor ◦ At

    least not what we considered refactoring in the past • May introduce side effects (seldom, nowadays) • Often creates big changes that are hard to review • Valuable tool if you use it with guard rails @[email protected] - @dtanzer.bsky.social 62
  32. How does AI benefit? • Low coupling / high cohesion

    keeps context small • Automated safety nets help validate AI results • Small steps make human review easier • -> What helps us make decision reversible also makes it easier to work with AI @[email protected] - @dtanzer.bsky.social 63
  33. • Easy to Change vs. Hard to Change • Design

    Decisions to Make Changes Easier • MMMSS • Feedback • Practice Refactoring • AI Benefits and Can Help @[email protected] - @dtanzer.bsky.social Conclusions 64
  34. David Tanzer • Freelancer since 2006 • Software developer /

    Architect • Trainer and Technical Coach ◦ Agile Engineering ◦ Modern Software Engineering • davidtanzer.net - devteams.at • [email protected] • https://social.devteams.at/@dtanzer • https://bsky.app/profile/dtanzer.bsky.social @[email protected] - @dtanzer.bsky.social 66