Is he doing some kind of rubber duck debugging?
http://en.wikipedia.org/wiki/Rubber_duck_debugging
I don't talk to myself, but sometimes by simply talking aloud about my problems to my peers I can flesh out a solution to a hard problem.
I have seen other programmers talk to themselves to find a solution when they're stuck, and it seems to work quite well.