5 ms·
Yea, when I read about people using AI with prompts like that, my first thought is, "Wow, that's like copy/paste, but instead of Ctrl-C/Ctrl-V, it's round-tripp
by ryandrake 5mo ago
Yea, when I read about people using AI with prompts like that, my first thought is, "Wow, that's like copy/paste, but instead of Ctrl-C/Ctrl-V, it's round-tripping to a server and using GPUs to do it." What's next? "Claude, rename the function doFoo() to performBar()"?
- simonw 5mo agoHere's the loop for a successful small refactor (anything beyond a rename that could be handled entirely by an IDE): 1. Find the code you want to change 2. Run the tests to confirm that test coverage is good for the starting point 3. Track down everywhere else that might call or interact with that code 4. Update the tests (red/green TDD) 5. Alter the code 6. Update the things that call the code 7. Run the tests again 8. Apply linters/formatters 9. Address any feedback from linters 10. Check to see if any documentation needs updating and do that 11. Land a commit with a descriptive commit message I can get all of that done with a coding agent with a single sentence prompt - especially if it's already in a session where it knows that I do "red/green TDD". ... and then I can work on something else while the agent is churning through those steps.
- ryandrake 5mo agoMy point is that all these steps can be done very quickly by even a junior developer who knows emacs or their IDE, in a codebase with existing lint/format/test automation, without even taking their hands off the keyboard. You're already in your IDE, you can probably do it just as fast there. I don't see the cost/benefit of spending tokens and hitting a server for this kind of work. I guess the difference may be in people's mode of AI working: Do you primarily develop in your IDE or a bunch of terminals running vim, and occasionally fire up claude to do more complex things? Or do you primarily develop in a long-lasting claude terminal, and occasionally tab over to the IDE to watch/codereview? In other words: What dev tool is on your primary monitor and what's on your secondary monitor? It's getting hard for developers in one camp to discuss coding and see eye-to-eye with developers from the other camp.
- simonw 5mo agoThose 11 steps would probably take me 15 minutes. There are a lot of small refactorings that I wouldn't consider to be worth 15 minutes of my time, so I wouldn't do them. Outsourcing those to an agent means I don't have to make that tradeoff, which means I can get better quality code. But yes, for a lot of my work I'm now a Claude Code / Codex first developer. I run Zed so I can navigate the code and occasionally make small edits.
- marcosdumay 5mo agoWhen you make the change on an IDE, you: 1 - Find the code 4 - Move the code 10 - Change the documentation You don't do the other steps because it's deterministic and always correct.
- simonw 5mo agoPresumably you're talking about statically typed languages? I mainly work in Python and JavaScript. I don't trust any refactors until I've seen the test suite pass. (OK, sure, "rename method" might be OK, but most of my refactors and design changes are more interesting than that.)
- mhitza 5mo agoShift-F6 (rename refactor) is my goto, and what I miss most in a code editor (maybe LSPs support that today for most languages). It also takes away the mental tax burden of thinking up good names for things when writing out code quickly on the first pass. Works very well with PHP (in PHPStorm), and I'd expect somewhat similar reliability in PyCharm on a Python project with some type annotations (or maybe even with none?). With the advent of LSPs and treesitter parser approach I wished to see higher level refactorings possible by now, but innertia in tooling space died down as most focus switched to LLMs.
- lanstin 5mo agoThe point of good names is not just readability but also to sharpen your cognitive model of the solution. That moment when you realize you don’t know what to name a thing is a valuable prompt to deepen your thinking a bit. And I sometimes prefer searching for the method names and changing them one by one (find-grip-dired followed by query replace) just to see where all the code is being used, if anything looks bad, if there is some opportunity for code reduction, etc. not that I don’t also prompt Claude to rename things, or better yet make sure all the SQL commands log enough etc.
- RealityVoid 5mo agoYes, it's copy pasting but it's tedious and it adds up fast. Even the doFoo to performBar is tedious because you need to catch all instances and your find/replace script strategy might have unintended victims. In this case indeed, it's just much more convenient.
- fridder 5mo agodon't LSPs and IDE's help with that?
- rustyminnow 5mo agoI'm right there with you - prefer classic, deterministic tools wherever possible - but there's a limit. E.g. it's easy to rename a single getter from classic enterprise java `Foo getFoo() {..}` to a modern style `Foo foo() {..}` ... but to rename dozens of getters/setters across hundreds of classes is still tedious. Even harder would be to update your setters from `void setFoo(Foo f) { this.foo = f; }` to fluent-style `Parent foo(Foo f) { this.foo = f; return this; }` - I'd be surprised if there's an LSP action for that at all. (I'd love to be proven wrong though)
- teraflop 5mo agoNot sure about LSP, but IntelliJ has had a "structural search and replace" feature for many years, and it can easily handle changes like the one in your second paragraph. It's conceptually like a regex search, but it matches language-specific AST subtrees instead of character sequences.
- yonaguska 5mo agoI've found that for super large but simple refactors, codex and Claude struggle and will just quietly stop doing what you asked it if it's a long running task. I actually had better luck asking codex to write temporary sed scripts based on the requirements then apply them.
- christoff12 5mo agoPerhaps, but do they handle all the other aspects of refactoring, too?
- jannyfer 5mo agoSometimes when I'm in the CLI and don't have a code editor open, I do this. Yes, it's lazy. But I also trust the model to check and update related things (tests, etc., while applying some judgement). It's not unlike some managers who tell their teams to do something trivially easy that they could have done themselves. (I'm not saying this is ideal and I'm not defending my laziness. It's just the current state of things.)
- geodel 5mo agoIt is indeed. At individual level thinking folks like yourself can think and do better of course. But all these AI companies are now heavily leaning on enterprises. And there I see function renaming via AI, or extracting column from excel sheet is not rhetorical but normal day to day task.
- bonesss 5mo ago> What's next? "Claude, rename the function doFoo() to performBar()"? As an engineer: of course not, keyboards are more efficient. Also as an engineer: of course, “tea, Earl Grey, hot”, or what are we even working for?
- lanstin 5mo agoMy son bought a Japanese water heater to keep a liter of water at just below boiling at all times. For my 4 pm Ceylon tea break, milk no sugar, I refuse to use the prefab water; preferring to stick with my routine of boiling the water, to a rolling boil, adding it to the tea bag in the cup, and letting it steep. One doesn’t take tea to maximize efficiency but to pause and plan, or just let go the reins on attention and see what happens. My son loves the always ready hot water.
- TeMPOraL 5mo agoYes, and ideally in this case LLM would be translating your intent into a series of invocations of specific APIs or scripts to do the transformations, and correcting for unexpected failures or realizations. Because it's often not just Ctrl-C/Ctrl-V. It's Ctrl+C/Ctrl+V, except today paste is Shift+Insert, and in the other project it's usually C-y, and you actually need to check one more place for full list of things to copy, and then you discover one case needs a minor transformation, ... LLMs can handle such annoying details intelligently. > What's next? "Claude, rename the function doFoo() to performBar()"? Yes. Such prompt can be issued in many equivalent ways, and works across environments, contexts and tool stacks. I can issue it from the phone, in form of "also doFoo -> perform... reame", and it will work even on Lisp code inside Word documents it accesses through Google Drive.
- renegade-otter 5mo agoFor one function, yes. I used Copilot to do massive refactoring on my project recently - switch to a new JSON library, completely switch web frameworks, etc. The stuff I needed to do but was putting off forever. And even with small things, it's just toil. You can start a small update and then realize with all the back and forth of edit/test/edit/test that you've been stuck in the OODA loop for 40 minutes you will never get back.
- vitally3643 5mo ago"Pft, you use an entire IDE inside an electron web browser eating 16GB of memory to rename a function instead of a simple regex? What a waste"
- jraph 5mo agoFirstly, yes, software bloat is a waste. Secondly, no, it's not even comparable with AI basically delaying electricity decarbonization on entire continent-sized countries, requiring entire coal-fired power stations and stealing all the ram and storage of the planet to build specific and short-lived hardware that will last few years and will be thrown away very fast.