copy-pasta

Don’t do it.

copy-n-paste

Just don’t. Once you see the same code appear three or four times, DRY it up. Name the concept, find the parameters, call that new helper a few times.

Copy-n-pasting similar code a few times may seem expedient, but it’s accummulating technical debt. Code is written once but read many times, and a properly named helper function will help your Readers, too.

And since that helper has a contract , it is a convenient target for a new unit test.

prev next

Copyright 2022 John Hanley. MIT licensed.