Well, I don't think he was PROGRAMMED by Anakin, but that Anakin took old parts he found and put them together, and found an old droid CPU and stuck it in Threepio's head. Granted that's reading between the lines a bit, but it's more likely than a 9-10 year old writing the program for a sentient being.