Simon Willison’s Weblog


6 items tagged “refactoring”


Comby (via) Describes itself as “Structural search and replace for any language”. Lets you execute search and replace patterns that look a little bit like simplified regular expressions, but with some deep OCaml-powered magic that makes them aware of comment, string and nested parenthesis rules for different languages. This means you can use it to construct scripts that automate common refactoring or code upgrade tasks. # 18th May 2022, 5:47 am


Weeknotes: Apache proxies in Docker containers, refactoring Datasette

Updates to six major projects this week, plus finally some concrete progress towards Datasette 1.0.

[... 1630 words]


Optimizing for the mobile web: Moving from Angular to Preact. Grubhub reduced their mobile web load times from 9-11s to 3-4s by replacing Angular with Preact (and replacing other libraries such as lodash with native JavaScript code). The conversion took 6 months and involved running Angular and Preact simultaneously during the transition—not a huge additional overhead as Preact itself is only 4KB. They used TypeScript throughout and credit it with providing a great deal of confidence and productivity to the overall refactoring. # 5th August 2019, 12:26 pm


The test for extracting common code should not be “Are they the same right now?” but “Do they have the same reasons to change?”

Chris Ford # 24th May 2018, 2:33 pm

2008 Neat community for discussing improvements to code snippets. Login using OpenID. # 28th June 2008, 11:46 pm


The Elements of JavaScript Style. Douglas Crockford illustrates better coding practises through refactoring of old code. # 13th September 2007, 8:22 am