Skip to content
CONTACT

Law of adopted code

PROGRAMMING AND BUGS

Code copied from the Internet works perfectly until you try to understand why it works.

— Anonymous, computing folklore
VIDEO.EXE16:9

Every programmer has a secret archive of lines borrowed from forums: solutions written by strangers, in another era, for another problem. You paste them in, they work, and you look at them with the gratitude of someone receiving a kidney from an anonymous donor.

Trouble comes when, out of conscientiousness, you try to understand them. You read, you reason, you remove a line that looks useless. Everything collapses. You put the line back. Now it doesn't work even with the line. The adopted code is offended and has decided not to forgive you.

Since then I've treated these lines the way the ancients treated amulets: respect, distance, no questions. My code still contains pieces with the comment 'no idea why, but it's needed'. They are the most stable lines in the whole project. Knowledge is sometimes overrated.