A Brewer's Guide to Filtering out Complexity and Churn

By Fito von Zastrow

Elevator Pitch

Complex code is expensive and risky to change. Most programmers are unaware of how their changes increase complexity over time. Eventually, complexity leads to pain and frustration. Without understanding the complexity, developers tend to blame Rails. Come learn how to keep complexity under control.

Description

Mechanical coffee machines are amazing! You drop in a coin, listen for the clink, make a selection, and the machine springs to life, hissing, clicking, and whirring. Then the complex mechanical ballet ends, splashing that glorious, aromatic liquid into the cup. Ah! Delicioso!

There’s just one problem. Our customers also want soup! And, our machine is not extensible. So, we have a choice: we can add to the complexity of our machine by jamming in a new dispenser with each new request; or, we can pause to make our machine more extensible before development slows to a halt.

Notes

Why this talk?

Our experience shows that: * Complex code is expensive and risky to change. * Most programmers are unaware of how their changes increase complexity over time. * Most programmers add code by mimicking existing code (i.e. complex code begets more complex code). * Eventually, ignored complexity leads to programmer pain and frustration. * Without understanding how they arrived at this place, programmers tend to blame their tools, including Rails.

This talk will help audience members fall in love with Rails again by using a metaphor to show: * How complexity sneaks into a code base * How to recognize when complexity is approaching the threshold of pain and frustration * How to refactor code toward a simpler place away from pain and frustration

Why These Speakers?

We are the right ones to give this talk because: * We love Ruby and Rails. * We both have over a dozen years of experience writing code in Ruby and Rails. * We work side-by-side with hundreds of programmers in a sprawling, overly complex Rails application with, 2 million lines of code and hundreds of methods with flog scores over 100

Outline (What’s in this talk?)

Introduction * Introduce speakers * Introduce topic

How does complexity sneak into a code base? * We’ll build a small coffee machine application that demonstrates: * How seemingly simple changes increase complexity over time * That existing code influences future decisions * And, that complexity leads to pain and frustration

How do you recognize complexity before it becomes painful and frustrating? * Quantify how painful things are by measuring complexity * Quantify how often you inflict pain on yourself by measuring churn * Set a threshold for how much pain you’re willing to endure

How can you turn it around before (or after) you’ve crossed that line? * Add duplication back into code to expose hidden abstractions * Extract code into polymorphic classes leveraging Ruby’s duck typing * Eliminate remaining churn by creating factory objects leveraging Ruby’s interpreted nature

Conclusion * Summarize main points * Call to action: What is the pain threshold for your application? * Contact information * Thank audience

Outcomes

Audience members leave: * Understanding how complexity sneaks into a code base over time * Empowered to monitor complexity and churn in their code base, and * Knowing how to prevent (or recover from) complexity induced pain and frustration * Falling back in love with Rails

Intended Audience

Rails programmers who are either: * Experiencing pain and frustration brought on by code complexity, or * Interested in avoiding that pain and frustration.