There was this guy who carried around a rubber duck. When he ran into a programming problem, he would explain the whole thing aloud to the rubber duck. By walking through the entire problem from start to finish, he would often find the answer.
You don’t need a rubber ducky to work through the problem. You can talk to a friend or really any object. So, if you’ve been wondering why rubber ducks are sometimes referenced in programming, that’s why!