(no title)
JackMcMack | 3 years ago
But if you need to fix it now: stop what you're doing and _roll back your changes_. This forces you to keep your changes small and self contained. There are other steps involved, such as writing down your steps to build a dependency graph, but the simple act of rolling back your changes is quite powerful. Don't want to throw everything away? Then maybe the thing you're trying to fix is not that urgent, and you can deal with it later.
[0] https://mikadomethod.info/
Tangentially related: I wish there was a way to record my code changes as executable actions on the AST, and attach it as metadata to a commit. As a simple example: I want to change the signature of a method, rearrange the parameters and add a new one. All you get from source control is some text changes, without an understanding of what those changes mean. If you need to reapply those changes you're stuck with the diff tools of a text editor. But if my IDE could understand those changes, it would be trivially easy to redo the refactoring actions. It might not be automatic (what value should this new parameter have if there is no default?), but at least you have some higher level tools available for dealing with that. To take this further: the changes might not even be in your codebase. A library was updated with breaking changes? Just execute the changes you can, and prompt for action when the changes fail.
I feel that recording your changes as actions on the AST is a powerful concept that needs further exploring. Sure, some things don't make sense to record on a higher level. If I add a new method it's much more readable to just add the code as text. But for anything remote complex it would be great if I can express my intentions as executable actions instead of (or in addition to) textual changes. Find all calls to functionA where parameterX is-a typeY and parameterY.value2 is not null, and make sure the caller sends the result of functionA to functionB in a new transaction. Kind of like how you can record steps with Selenium IDE and use that to create something with clean api calls. And the best part: because you've already made the change it's easy to test if your higher level change results in the same change in your source code.
No comments yet.