tag:news.ycombinator.com,29801240:29806789 function_seven function_seven https://news.ycombinator.com/item?id=29806789

I have a tangentially related issue. It’s completely irrational, but I can’t shake it. Sometimes when writing code, I need to add a block that looks a lot like an existing one, so I’ll copy it and paste just below. (Yes, I know, DRY. Sue me :)

The irrational part comes in when it’s time for me to make the tweaks. Maybe I’m working on a yaml config file, and I need to specify two objects that are mostly the same, with minor changes to one of them.

I’ll make sure I’m working on “the copy”, and not “the original”. So, let’s say I start with this:

- author: E. Hemingway
  title: The Old Man and the Sea
  medium: hardcover
  edition: 1
  published: 1952

And the project manager says I need to add the second edition paperback to the list. I’ll find that block, copy the whole thing, and *then make sure I don’t disturb the “original”:

- author: E. Hemingway
  title: The Old Man and the Sea
  medium: hardcover
  edition: 1
  published: 1952
- author: E. Hemingway
  title: The Old Man and the Sea
  medium: trade
  edition: 2
  published: 1953

Basically, I’ve internalized that my bits have a color[1].

[1] https://ansuz.sooke.bc.ca/entry/23