Code Monkeys Don’t Finish Things – Only Start Them

Code Monkeys

Today I was looking at the check-ins and saw something that was a good idea, but it wasn't really completed. I knew the guy on the team that did it, and I could easily see why he'd stopped half-way through: he didn't see what he'd really started as something more than a little hack to the problem he had. This is one of the things I'd like to be able to teach people, but I'm worried that it's really something that people have to want to see.

Initially, we had one source for merchant data, and one source for demand data. To be fair, we had two: fixtures (static files that make offline testing nice), and a "live" source. We could switch between these with a simple config option:

  # control whether to use the real data sources
  use_fixtures: true

or:

  # control whether to use the real data sources
  use_fixtures: false

But we're moving forward, and it is very reasonable to think that we have multiple sources for each of these. Right now, we have the need to think of multiple sources for the merchant data, while just two for the demand. The coder implementing the need for the multiple sources for merchants added a config option:

  # control whether to use the real data sources
  use_fixtures: false
  # select from 'fixtures' | 'sf' | 'm3'
  merchant_from: 'sf'

to indicate that the merchant data is coming from Salesforce. We can add other options in the code, and this is very nice and extensible.

The problem is that this really doesn't address the logic inconsistency of having those two options in the same file. If we're using Salesforce for the merchant data, what does "using fixtures" mean? Why not just add:

  # select from 'fixtures' | 'sd'
  demand_from: 'fixtures'
  # select from 'fixtures' | 'sf' | 'm3'
  merchant_from: 'sf'

so that we're specifying all the inputs the same way?

This is the finished idea. What was done was only really half the problem solution, and in leaving it half done, it really lead to a lot of confusion that just didn't need to be there. It's this insight that I'd love to be able to teach coders that don't see it.

But given that this coder is way past 20, I'm guessing he doesn't consider himself "junior", and therein lies the other problem: He's not thinking he needs to learn this. Sad, but true.

Anyway… I have to check these changes because of just this level of incompleteness.