PyCon Israel 2023 Workshop

Refactoring Without a Net
07-05, 14:30–17:30 (Africa/Cairo), Room II

Refactor ugly legacy code, using design patterns for fun and profit


Code sucks. Well, not all code. If your code is clean, it doesn't. But for that to happen, you need to refactor all the time. But here's the catch: Refactoring without tests is risky. Without that safety net, you're not going to try. So, it's off to writing tests we go.

Unless, of course, there are other ways. Do you have some, Gil?

While there is no real replacement for tests, we can take shortcuts.

In this session, I will discuss refactoring, including examples of how to do it when you don't have tests but still don't want to bring the house down.

I'm going to talk about how to tackle different scenarios, understand the risks, and how refactor code that doesn't have actual tests. I will also show refactoring patterns using the lovely ApprovalTests open-source tool.

Refactoring may be risky, but it's not a yes/no option. You can still improve the code and make changes easier with these tips.

Gil Zilberfeld (TestinGil) has been in software since childhood, writing BASIC programs on his trusty Sinclair ZX81. With more than 25 years of developing commercial software, he has vast experience in software methodology and practices.

Gil has been teaching and applying modern development and testing principles more than a decade. From automated testing to exploratory testing, testing methodology, unit and integration testing, clean code and testability‚ he has done it all. He is still learning from his successes and failures.

Gil speaks frequently in international conferences about unit testing, TDD, testing in general and design practices. He is the author of "Everyday Unit Testing" and "Everyday Spring Testing". He blogs and post videos, and in his spare time he shoots zombies, for fun.