Agile Event Session

Mastering Legacy Code: Preventing Bugs in Code You Can’t Test

This video content is for Agile Alliance members only

If you’re already an active member, please log in now.

To view this content, and gain access to many more valuable resources, conference discounts, and invitations to exclusive networking and learning events, please consider becoming an Agile Alliance member.

Abstract/Description

I can’t test this code because the design is awful. I can’t refactor because I don’t have tests. Yet it keeps having (and breeding) bugs. Now what? — Everyone, everywhere

Arlo has talked in the past about how this apparent catch-22 is resolved by a better understanding of the word “refactoring” — that using a specific set of techniques allows defect detection and prevention even in untested — or untestable — code.

In this session he shows you those techniques by applying them to some gnarly code.

This session is 75% live-coding, 25% talking.

Most of the talking is Arlo asking questions. So watch this session if you want to think, want to get your hands dirty, and want to see specifics that you can try to apply immediately in your own code.

Agenda:

  1. Microtesting: understanding what the code does and deriving a spec.
  2. Resolve microtesting blocker: mechanically spot CQRS violations; resolve them via extract method + make method static.
  3. Resolve microtesting blocker: mechanically spot multiple responsibilities in a class; resolve them via extract method + make method static + introduce parameter object.
  4. Safeguarding: preventing bugs by eliminating hazards.
  5. Remove hazard: primitive obsession leads to inconsistent computation; resolve it via introduce parameter object + extract method + move method.

Additional Resources

Add to Bookmarks Remove Bookmark
Add to Bookmarks Remove from Bookmarks
Add to Bookmarks Remove from Bookmarks

Speaker(s) may be willing to present this session at local group meetings and other events.

deliver:Agile 2018
Video
Practicing

More Agile Event Session Videos

FP vs. OOP: Beyond the Bikeshed
In object-oriented languages like Ruby, people often say that “everything is an object”—but first-class functions have become standard for object-oriented languages too. C# has had them and other related features for years, and even Java is in the ga…
Testing Without Mocks: A Practical Guide
Are your tests slow or brittle? Do you get a sinking feeling when you need to refactor? Do you worry your unit tests aren't actually testing anything important? If so, you could benefit from exploring a mock-free approach to TDD. This session is a c…
Building Your Team to Last
Hiring and on-boarding new team members is an expensive and risky process. It's crucial to hire people who mesh well with the existing team and get them up to speed in a timely manner. Balancing this while minimizing the initial impact on productivit…
FP vs. OOP: Beyond the Bikeshed
In object-oriented languages like Ruby, people often say that “everything is an object”—but first-class functions have become standard for object-oriented languages too. C# has had them and other related features for years, and even Java is in the ga…
Testing Without Mocks: A Practical Guide
Are your tests slow or brittle? Do you get a sinking feeling when you need to refactor? Do you worry your unit tests aren't actually testing anything important? If so, you could benefit from exploring a mock-free approach to TDD. This session is a c…
Building Your Team to Last
Hiring and on-boarding new team members is an expensive and risky process. It's crucial to hire people who mesh well with the existing team and get them up to speed in a timely manner. Balancing this while minimizing the initial impact on productivit…

Have a comment? Join the conversation

Discover the many benefits of membership

Your membership enables Agile Alliance to offer a wealth of first-rate resources, present renowned international events, support global community groups, and more — all geared toward helping Agile practitioners reach their full potential and deliver innovative, Agile solutions.

Not yet a member? Sign up now