The Google Method of Programming

It was already a couple of months into his summer job and Wing was fitting in with the team quite nicely.  And although he was very smart and very quick to pick up things, there are times when he relied too much on “The Google Method Of Programming”.  It goes like this:

  1. you are faced with a problem
  2. you think “someone else must have already solved this”
  3. you type some keywords defining the problem into Google, and randomly stumble through a dozen solutions that other people have posted online until you find one that doesn’t look stupid
  4. copy the solution code and paste into your application, then tweak it as needed
  5. run it and see what breaks
  6. go back to step 3 with different keywords and search for dozens of other solutions

How do I know Wing took this approach?  Because the evidence was found quite easily during code review.  Like a review of this chunk of code:

$loop = 1;
$numFields = $total + $loop - 2;
for ($loop=0; $loop < $numFields; $loop++) {
    // Do Stuff

“Wing?  I really need to ask why you’re taking a number, adding 1 and then subtracting 2.  You know the math on this really isn’t that hard.”

“Oh. Right. Thanks, I’ll fix that.”

“Sure.  Also, why are you initializing the $loop variable up top, when you don’t need it for the second line, and then only end up re-initializing it in the for loop?”

“Right. I’ll fix that, too.”

“Thanks.  Finally, why did you put a comment ‘do stuff’ ? I don’t think that’s a useful comment.”

At this point Wing was silent.  Perhaps deep in thought about something.  Then he mustered up the courage to admit: “that isn’t really my code.  That is someone else’s code I found online.  Not my code, not my comment.”

“Yes, I know.  It’s blindingly obvious.”


“There is no problem in using Google to see what other programmers have done, but if you’re going to use someone else’s code, you absolutely need to clean it up.  It has to pass your own personal code review before it ever gets to me. OK?”


After that I was pleasantly surprised – I never did see another fragment of code obviously left over from Googling.  Progress.