Some of my colleagues had a hard time with this. They would actually ask me to come to their desk whenever I had a question, and come to mine when I didn't answer fast enough (only after I had gotten them to understand I really preferred slack. Seems they never got the why though, despite making it very clear...)
Yep, there are some people who just don't get it, and it's hard to get them to. I find that most developers have a hard time even bringing up the issue with someone face-to-face, even though all it usually takes is: "Hey, just wanted to let you know, I really prefer having these sorts of exchanges over Slack. Otherwise I find it really disruptive to my day. Could we give that a try next time and see how it works out?" And you have to be willing to escalate if the behavior doesn't improve: "Listen, I asked if we could take care of these things over Slack, and I'd really appreciate it if you could accommodate me here." Then: "Hey, I know I keep bringing this up, but it's really important to me. I need to keep a lot of my day interruption-free in order to be productive. Please try harder to respect my time when coming to me for help."
It seems most developers aren't even comfortable with the first bit, let alone escalating things. Instead, most people just seethe and complain privately to other colleagues, and nothing changes. At the very least, the team's manager should be brought in to do a better job of protecting the everyone's time, and you'd think that would be easy for a developer to do, because it outsources any sort of confrontation. But it still often doesn't happen, for whatever reason. (Of course, if it's the manager who is the offender here, you're probably screwed if the diplomatic method fails.)
Walks in? Yes. That should be discouraged always.
Spamming on Slack? If that is a problem, you're doing Slack wrong. It's an asynchronous method of communication. Don't be buried in it or feel the need to respond to every message as it comes in. Check it during natural breaks or stopping points.
If something actually is urgent and requires your immediate attention, then they can break the above rule and walk up to your desk (or call you if you're remote).