Loading…
SATURN 2019 has ended
Tuesday, May 7 • 1:00pm - 1:45pm
The DRY Principle Is Misunderstood

Sign up or log in to save this to your schedule and see who's attending!

Feedback form is now closed.
The Don’t Repeat Yourself Principle has swept the world. It is often the first thing new engineers are taught. It has probably affected your current code base in a big way. However, despite your code being "DRY," your code is hard to change. Files have to be changed for seemingly unrelated reasons as shotgun surgery and code brittleness abound. You might ask yourself, “Why is this happening?”

In this talk, I will show you that the DRY Principle actually is about eliminating duplicate representations of “concepts” in their system. Duplicate code is often misidentified as part of this principle, and attempts to clean it up are made. The end result is lots of shotgun surgery (many places change for the same reason) or divergent change (one place changes for many). This yields tons of pain for the development team, and eventually a clamor for a complete rewrite of the system.

I will give you three techniques to highlight incorrectly DRY code. These are
  • focused conversations with the product team
  • asking yourself the question "can I reason about this separately?" before you remove duplication
  • how to notice shotgun surgery or divergent change

Once you know how to identify incorrectly DRY code, I will walk you through a code example where introducing a new path is very difficult. We will refactor the code so that the independent concepts are isolated. Once the code is fixed, I will show how easy it is to make the desired change—no extra conditions required.

See the slides.

Watch the video.

Speakers
avatar for Steven Solomon

Steven Solomon

Senior Software Engineer, Pivotal Labs
Steven Solomon is a Senior Engineer at Pivotal Labs. He has spent many years writing software on teams in many industries and languages. He is passionate about writing clean code and wants to share his experiences with you. If that doesn't work, he’ll play you some blues guitar... Read More →


Tuesday May 7, 2019 1:00pm - 1:45pm
Grand Station 3 Sheraton Pittsburgh Hotel at Station Square

Attendees (16)