2 ms·
I was looking for this. There are definitely two types of duplication. For example not every use of the number 16 should be replaced with a SIXTEEN constant. Ho
by kevincox 3y ago
I was looking for this. There are definitely two types of duplication. For example not every use of the number 16 should be replaced with a SIXTEEN constant. However if the maximum allowed password length is 16 you shouldn't be writing 16 all over you code, you should be writing MAX_PASSWORD_CODEPOINTS because your system may depend on that value being consistent.
Although I would disagree that you should never deduplicate things that are coincidentally the same. Sometimes code that is coincidentally the same can have the same bugs and require the same updates over time, so deduplicating them can reduce maintenance cost and remove bugs. However I wouldn't race to deduplicate these things. Just if they become frequent patterns or have remained the same for long enough to justify the effort to unify them.