Hacker News new | ask | show | jobs
by sltr 2 days ago
the punchline: "Refactoring reduces token consumption"

I appreciate the effort to quantify the benefit rather than pontificate. It's worth mentioning Martin Fowler wrote a whole book on refactoring [1], in which he states, "to refactor, the essential precondition is [...] solid tests", which I think is the real benefit here, AI or not. Good tests protect against regressions, whether human or robot. They also help encode the spec, which humans and robots can read.

[1] https://www.oreilly.com/library/view/refactoring-improving-t...

2 comments

(Just to note that although the article is on martinfowler.com Martin is not the author. It's attributed to Thoughtworks CTO Giles Edwards-Alexander.)
Thanks for catching that. Updated my post
Oh. That's kind of disappointing.
I think the real punchline was that the value saved was on the order of cents!

> Every single change that touches the data access layer from this point forward now costs significantly less.

> How much of a saving? Assuming Sonnet 5 pricing at the time of writing of $3/MTok, 39.7 cents.

Now consider OpenAI's price drop, and open models, and consider that in the long run tokens will get cheaper. And think that the refactor needs to be human guided at a price of what for a senior developer - $100/hour?

> I think the real punchline was that the value saved was on the order of cents!

If the agents can read less tokens in the future, and make changes more effectively then this would add up over time.