3 ms·
Ever heard of a function? If it's as simple as copy paste, that's all you need. The trickier abstractions come when you need something to be almost the same in
by woah 10y ago
Ever heard of a function? If it's as simple as copy paste, that's all you need. The trickier abstractions come when you need something to be almost the same in two places. Copy and paste tracking wouldn't work there.
Replacing functions with some kind of copy paste tracking editor does not sound like an improvement.
- taeric 10y agoCoverity actually has a really good tracking ability where it will find code that was copy/pasted/edited but the edit looks wrong. I can't remember the name, but it will identify what it thinks is the original, and show where the copy/paste is, along with the edit it thinks was missing. This was usually around some error handling logic in our code base. Think: if (checkIsValid(foo)) { printf("Looks like foo is not valid. foo == %s\n", foo); } Wasn't uncommon for someone to copy that and forgot to change all places "foo" appeared. Long story short, advanced static analysis has come a long way.
- wruza 10y agoThis is already solved on bigger scale -- RCS. You can develop, merge, blame, diff slightly different filesets, but not lineranges. Look, we already have both 'just functions' and dry-vs-complexity problem unsolved.