Hacker News new | ask | show | jobs
by marcosdumay 24 days ago
When 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.

1 comments

Presumably 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.)

Shift-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.

The 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.

Use the Python type hints. You don't need to be specific, they help a lot even when you have some 'anys' inside composed types.

Anyway, Python tools are usually capable of refactoring any code that isn't reflective or self-rewriting. There are places for those two, but those are very few and the AI won't have any idea how to work at those places either.

JavaScript is a problem.