News for hackers. Stuff that matters.
Re:Don't spend 6mins doing it by hand when you can spend 6h ... by gumby on Thursday December 09, 2021 @02:57PM (#29502120)
The other reason for automating a repetitive task is to reduce errors. When you do the same think 100 times you're bound to miss an instance, or paste the text in in the wrong place, or whatnot.
Re:Don't spend 6mins doing it by hand when you can spend 6h ... by jfengel on Thursday December 09, 2021 @05:01PM (#29503543)
But rewriting code isn't always a repetitive task. If you're trying it with anything other than a full parser and refactoring toolkit, you risk breaking the code in ways that you don't realize because you're not actually looking.

If you really have written the same code many times, you might be able to get away with a search-and-replace approach, and with a little luck everything you break will get caught by a compiler. But the more different ways you wrote it, the more likely you are to make things worse.

Learning a refactoring toolkit might be a fun project, but it may well take more than just a few hours. Code-that-writes-code is pretty tricky.

As you say, the alternative is also risky. So getting it right may be worth the effort. But in a lot of cases, it will be quite a bit of effort.

Re:Don't spend 6mins doing it by hand when you can spend 6h ... by gumby on Thursday December 09, 2021 @06:35PM (#29504624)
It need not be code; it could be deleting the phone numbers from a plaintext database. Or any number of manual one-time tasks on data.