There's a piece of "wisdom" floating around in programming culture that says you should never interrupt programmers. I imagine it comes from early-stage startups, where the business is make-or-break on getting a viable product out the door as fast as possible. In that context, it makes some sense.

Once the business is running, though, it's ludicrous. The programmers aren't the only work center that matters any more, and they probably aren't even the most critical one. If you as a programmer have information that someone needs, it's part of your job to take your headphones off for a minute and talk to them.

Look, I get it: interruptions can break your concentration and make you lose time while you rebuild your train of thought. And there are definitely better and worse ways to execute an interruption: charging into the room already talking, or installing a device on someone's desk that makes a loud insistent noise on demand, is terribly rude. If someone sends you an IM, though, or comes into the room and waves a hand to get your attention, get yourself to a stopping place and talk to them.

Other people have jobs too. Their jobs are important too. Unless you're absolutely, 100% sure that your productivity is the tightest constraint on your business's throughput, optimizing it isn't even all that important. Instead you should focus on doing what you can to ensure work is moving smoothly through the company as a whole.

Now, there is a pathological case where interruptions really are a problem. If you're spending your whole day, every day, responding to do-it-now requests, it's almost a certainty that you aren't working on the actual high-priority tasks. This is a management problem, though. The solution isn't to be a surly jerk who snarls at anyone with temerity to bother them. The solution is to start bumping these requests up the chain: "I'm sorry, but I'm really swamped. Can you talk to my boss so they can find you someone to answer your question?" Prioritizing and queueing tasks is a project manager's raison d'etre. They love doing that stuff! Let them do it!

On the other hand, it's never acceptable to touch a programmer's screen. Keep your greasy fingers to yourself!