Live data from Hacker News

The Economic Benefit of Refactoring

martinfowler.com

71–80 of 132 posts

Re: The Economic Benefit of Refactoring

#72
I think the name of the game is going to be "how do we maximize output while keeping token counts low". For example, finding ways to replace AI workflows, even if minor ones, with scripts/code.

Anthropic told me that I have till August 19th to be get my act together becuase they are going to reduce my token count by 50%. lol. I have been abusing my Pro Max allowance and need to start being less wasteful.

Articles like this, can help us come up with ideas on how to do it.

Re: The Economic Benefit of Refactoring

#73

Earlier quoted context omitted.

To be clear, the guy who wrote this article is Martin Fowler. Fowler was the author of a book literally titled "Refactoring", which he wrote over 20 years ago (it didn't invent the term "refactoring", but it's widely credited as popularizing it). In other words, this is not some new AI-bandwagon-jumping blogger trying to rebrand old practices as something new ... this is the guy who coined the very term "refactoring"…

The website is martinfowler.com, but the article seems to be written by Giles Edwards-Alexander.

Oh, I stand corrected (thanks for the catch)!

Re: The Economic Benefit of Refactoring

#74

I find it funny how the best practices for programmers, ignored in most IT companies, get reinvented as the best practices for AIs. Boring: The documentation should be in code, not in external Word documents uploaded to the company SharePoint server. Exciting: The documentation for the AI should be in code, not in external Word documents uploaded to the company SharePoint server. Boring: You should give your develope…

To be clear, the guy who wrote this article is Martin Fowler. Fowler was the author of a book literally titled "Refactoring", which he wrote over 20 years ago (it didn't invent the term "refactoring", but it's widely credited as popularizing it). In other words, this is not some new AI-bandwagon-jumping blogger trying to rebrand old practices as something new ... this is the guy who coined the very term "refactoring"…

My namesake, er, not quite ;).

Re: The Economic Benefit of Refactoring

#75
This is interesting, but I think it would be even more interesting to see a comparison of the token cost of adding a new feature, in the original codebase vs the refactored one. You'd think/hope that the cost of adding the new feature would be lower when starting from the refactored codebase, indicating that refactoring makes economic sense in the long run by lowering the cost of adding new features.

Re: The Economic Benefit of Refactoring

#76

I find it funny how the best practices for programmers, ignored in most IT companies, get reinvented as the best practices for AIs. Boring: The documentation should be in code, not in external Word documents uploaded to the company SharePoint server. Exciting: The documentation for the AI should be in code, not in external Word documents uploaded to the company SharePoint server. Boring: You should give your develope…

No this isn't mindless reinventing --- this is finally having clear empiric evidence for something that we knew the entire time. This is a huge relief! Next up is demonstrating the AI is more productive with better programming languages.

i can't wait for that one haha

Re: The Economic Benefit of Refactoring

#77
post #49
post #32

Earlier quoted context omitted.

I did not mean it as a metric but as an indicator what was wrong with the code. - the code is essentially good but all is in one file, you split it up, lines of code stay the same - the code is essentially good but lacks some structure, for a function that does five things directly, you extract the functionality into five functions and call them from the original function, lines of code goes very slightly up But once…

> What scenarios are there where the code is actually bad but refactoring does not reduce the lines of code? IMX: the scenarios where people hold higher standards than what you describe :) (i.e. such that "the function does five things" is deemed "actually bad". Of course, that does depend on the refactoring not causing an unacceptable performance hit, which can happen depending on the environment.)

Don't get me wrong, a function doing five things is bad. I consider code not good if you write if(condition) instead of if (condition) or a +b instead of a + b. Not that it is really bad on its own, but it indicates to me that the code was written with little care and I should probably expect bigger issues.

What I really want to get at is the distinction between leaving the actual code untouched and just moving it a bit around - to other functions, other classes, other files - and having to change the code - from deduplicating to completely rewritting it.

Re: The Economic Benefit of Refactoring

#78
post #62

Earlier quoted context omitted.

> Next up is demonstrating the AI is more productive with better programming languages. That actually would be pretty exciting! But, wouldn't AI be biased toward more popular languages, since those will by nature of their popularity provide more sources for training material? Even still, the AI could demonstrate which algorithms or maybe patterns and techniques are more productive, in the context of the popular langu…

That’s not necessarily a bad thing. As an example, 110v American outlet plugs are almost certainly not the most efficient way to power devices and appliances; but, because they are so standard and are good enough, using them massively eases the burden of making, buying and selling powered appliances in the US. Similar story with USB C.

> That’s not necessarily a bad thing.

True, and to my point, "popular" isn't necessarily "better".

> because they are so standard and are good enough, using them massively eases the burden of making, buying and selling powered appliances

Yes, but LLMs can do the heavy lifting when analyzing the "better programming languages" for productivity. There will be a bias toward popularity in their training sources, though.

Post reply on HN