Refactoring PyChart
summary
Argues that no tests no refactoring and shows refactor steps applied to PyChart: make imports explicit, turn module imports into class imports, consolidate public classes into a single module, encapsulate color generation, and extract file handling from canvas classes. Removes global state and the exit-hook that prevented embedding, and adds an HTML5 canvas output. Uses the existing demo suite as tests, performs changes manually (tries Eclipse and PyCharm but relies on hand edits), and notes the project is unchanged since 2006.
AI-written summary · about
chapters (8)
- 0:00Introduction to refactoring
- 0:51Core principles and workflow
- 4:43Strategies for refactoring
- 7:24Analyzing the PieChart library
- 10:42Applying refactoring steps
- 16:46Refining file handling
- 20:58Real-world usage and tooling
- 25:31Q&A and closing thoughts
related talks
25mMaking Codebases Easier to Learn and Maintain
45mRefactoring Graphite to Diamond
57mTechnology mix: From legacy to clean architecture
42mInheriting a Sloppy Codebase: A Practical Guide to Wrangling Chaotic Code
35mRefactoring for fun and profit
31mTechnical Lessons Learned from Pythonic Refactoring
26mTherapeutic Refactoring
44mThe Art of Refactoring
