LLMs and code duplication

I’m working on a project for which I’m using Go, as well as LLMs, mostly Sonnet 4.5 via Claude Code. I’ve noticed that it is frequently passing up on opportunities to factor out common code. But I’m not at all sure this is a bad thing. Here is an example, which I’ve chosen as relatively short but it illustrates a pattern which is relatively common: if config.DatabaseType == "postgres" { query = ` SELECT p.slug, COALESCE(NULLIF(p.menu_title, ''), p.title) as menu_title FROM pages p INNER JOIN site_pages sp ON sp.page_id = p.id AND sp.site_id = $1 WHERE sp.is_homepage = false AND sp.site_id = $1 ORDER BY p.title ` } else { query = ` SELECT p.slug, COALESCE(NULLIF(p.menu_title, ''), p.title) as menu_title FROM pages p INNER JOIN site_pages sp ON sp.page_id = p.id AND sp.site_id = ? WHERE sp.is_homepage = 0 AND sp.site_id = ? ORDER BY p.title ` } Ignore the fact that there may be better ways to handle differences between database flavours. The point here is that these two queries are almost identical, except for the parameter placeholder and boolean value. A much better way to write this would be to have a single query with the differences parameterized: ...

December 16, 2025

More on A.I. Water usage - Empire of A.I.

A few weeks ago I wrote about an issue in the book ‘Empire of A.I.’ by Karen Hao. There is now a much more in-depth look into this issue by Andy Masley. It includes a response from the author and Andy’s response to that response is well worth reading even if you don’t read the main (very detailed) post. I think both are writing in good faith here, it must be terrible to work on a book only to find you have published an error, which does seem to materially change a (fairly large) point you are making in your book. I do think Andy is correct though. ...

November 24, 2025

A.I. Water usage - Empire of A.I.

Update: 2025-11-24 Andy Masley has a much more in-depth look at this is issue, including a response from the author, and his response to that response is well worth reading. I’ve been following some of the debate on the water usage of LLMs. A lot of people seem concerned that this is a large issue. I’m not sure either way, but I’m coming round to the view that water usage is not a major concern, in comparison to, for example, the energy usage. ...

November 3, 2025

Link: Where's all the shovelware?

A couple of weeks back after the GPT-5 release, I wrote a skeptical post that the fact that the GPT-5 model picker release was botched was something of a bearish sign for llm-assisted programming: Okay, but if OpenAI cannot utilise their own models in coding/dev-ops to avoid a high-profile failure on a very high importance launch, what chance do other companies have? Why hasn’t the A.I. enabled OpenAI to improve their development/deployment strategies to avoid such techincal glitches? ...

September 4, 2025