Skip to content
  • Sign In
  • Try Now
View all events
Refactoring

Fundamentals of Refactoring

Published by O'Reilly Media, Inc.

Beginner content levelBeginner

Write code that is easier to understand and cheaper to modify

Refactoring is something all developers do—consciously or not—when writing code. But often the task is guiltily avoided or sacrificed to time constraints. Sometimes teams have areas of code that need so much refactoring, it gets set aside as a separate task. But the longer it’s left undone the longer it takes to do—and the more likely it never gets done at all.

Join expert Clare Sudbery to go through one worked example in detail (demonstrated in C#, but with individual activities in the language of your choice), and revisit the same example in different circumstances while reflecting on what you have achieved and, in the process, learning how to refactor in tiny chunks and with good test coverage. You’ll learn ways of seeing refactoring as a daily, achievable task instead of an insurmountable mountain, and you’ll hear lots of good arguments as to why it’s not only worthwhile but essential for robust, maintainable code. You’ll also discover the benefits of compassionate refactoring, which will help you avoid pointing the finger of blame when you feel your code has not been maintained effectively. No code base is ever perfect, and forgiveness is a handy technique for improving the future without bemoaning the past.

What you’ll learn and how you can apply it

By the end of this live online course, you’ll understand:

  • Why refactoring works best as a daily task
  • Why refactoring is essential for robust, maintainable code
  • How a “trunk-based” approach to refactoring happens during daily work instead of in a separate branch, helping you avoid merge issues

And you’ll be able to:

  • Decide what and when to refactor
  • Plan how to fit refactoring around other work
  • Ensure that refactoring doesn’t derail “business as usual”
  • Reduce refactoring risk via robust test suites and small changes

This live event is for you because...

You’re a developer working with a code base that needs refactoring.

  • You’re a developer who wants to better coordinate refactoring efforts with your team.
  • You’re a developer who’s always in a rush and wants to establish better refactoring habits.
  • You’re a developer who wants to learn how to make good choices about what and when to refactor.

Prerequisites

  • A computer with the IDE of your choice installed (Visual Studio Code, Rider, IntelliJ, or Visual Studio)
  • The ability to write code in at least one of the languages listed here
  • Some experience writing unit tests and using a source control tool such as Git (helpful but not required)

Recommended preparation:

  • Read “Principles in Refactoring” (chapter 2 in Refactoring: Improving the Design of Existing Code)
  • Prepare the tooling you require to write code in your language of choice

Recommended follow-up:

Schedule

The time frames are only estimates and may vary according to how the class is progressing.

Introduction to refactoring (30 minutes)

  • Presentation: Definition of refactoring; grounding in a real story; the benefits of refactoring; when to refactor
  • Q&A
  • Break

In at the deep end (60 minutes)

  • Presentation: Brief introduction to the Gilded Rose Kata
  • Hands-on exercise: Refactor the Gilded Rose with no tests available
  • Group discussion: What challenges did you encounter?; analyze the problems you faced
  • Q&A
  • Break

Basic principles in action (30 minutes)

  • Presentation and demo: Taking small steps; always run the tests; committing moves separate from code changes; using a trunk-based approach; choosing refactorings based on performance evidence rather than instinct or preference
  • Q&A
  • Break

Approval testing—Part I (60 minutes)

  • Presentation: Introducing approval tests
  • Hands-on exercise: Refactor the Gilded Rose with approval tests
  • Group discussion: Analyze the problems you faced; What have you learned and what will you do differently?
  • Q&A
  • Break

Approval testing—Part II (60 minutes)

  • Hands-on exercise: Continue the kata, or start from scratch
  • Group discussion: What challenges are you still facing, and what have you learned?; final analysis
  • Demonstration: An example solution
  • Q&A

Your Instructor

  • Clare Sudbery

    Clare Sudbery is an independent technical coach with 23 years of software engineering experience. She specialises in TDD, refactoring, continuous integration and other Extreme Programming practices, also known as XP.

    In 2009, Clare abandoned IT to retrain as a high school math teacher, but quickly returned to software, gaining new energy via XP. Clare teaches the Coding Black Females’ Return to Tech programme and co-ran Made Tech’s academy. She has a passion for helping under-represented groups to flourish in tech.

    Clare hosted Season One of the acclaimed Making Tech Better podcast, and publishes notes and scribbles on her Medium blog called "A Woman in Technology", on her Clare Wiki website and on her blog called "In Simple Terms". She’s also a published novelist and has presented workshops and talks at several national and international events and conferences.

    Clare hosted Season One of the acclaimed Making Tech Better podcast, and publishes notes and scribbles on Medium, on her at medium.com/a-woman-in-technology, clare-wiki.herokuapp.com and insimpleterms.blog. She’s also a published novelist and has presented workshops and talks at several national and international events and conferences.`

    linkedinXlinksearch