3 ms·
I'm not particularly bothered by having to change several places. The situations where I couldn't solve it with things like grep, find, sed have been very rare,
by cess11 2y ago
I'm not particularly bothered by having to change several places. The situations where I couldn't solve it with things like grep, find, sed have been very rare, and this kind of solution crops up every now and then.
One of the more common examples is generated code, where I prefer to put that on the side and then copy in the files to the appropriate place in the application and then update things like package declarations in bulk. It makes it harder to overwrite manually added comments or code by mistake.
Tools like ast-grep help too, when more sophisticated search-replace is required.
So I agree, at least in less mature systems DRY is a bad idea that causes a lock-in that will bite you at a later time. Often it's much harder to tear apart a DRY abstraction than creating one.