1、Refactoring Large,StubbornCodebasesJake ZimmermanGetty D.RitterNovember 19,2024jezaisamanra1Complaints about stubborn codebasesOur code isnt modular enough!This dependency is 10 years out of date!We need to change how we talk to the database!We can refactor to a happy state!2Best to centralize the r
2、efactor Have one team drive the refactor:concentrates expertisemost problems will be repeat problemsincentivizes automationfewer engineer-hours overallmore likely to finishno need to wait for each team to plan and prioritize3Centralized migration needs two things:Leverage over the codebaseWay to rat
3、chet incremental progress4Toyou need toand torefactor a large,stubborn codebasehave a point of leveragepick good ratchets.5Agenda Improving developer satisfaction with SorbetMaking a Ruby monolith more modularLessons learned from ratchets ratcheted67 Stripes developers were unhappy“hard to understan
4、d”(sentiment from company-wide survey)“waiting for tests is slow”“only breaks in production”“dont trust the docs”“too much low-quality code”8 Building Sorbet introduced leverage“hard to understand”“waiting for tests is slow”“only breaks in production”“dont trust the docs”“too much low-quality code”(
5、sentiment from company-wide survey)IDE aids understanding all code type checks in seconds type checker catches bugs in CI runtime makes types trustworthy bad code is hard to type9Brief history of Sorbet?Began fall 2017Stripe:800 employees(200 400 engineers)Initial project:3 engineers,full timeTimeli
6、ne9 months to build Sorbet but has served as the foundation for hundreds of codemods3 months to get to 75%adoptioncontained to just three engineers10Aside:you can do it too!?Tools that you can use to bootstrap something:,your languages linter,BYO:tree-sitter parsers,LSP server libraries,GitHub code