IIRC, one of the reason Judit Polgar is so good at chess is because she uses the part of her brain that recognizes faces to remember certain board configurations (ever wonder how people can recognize faces they've seen briefly before so easily?). Her memory was trained from a very young age, but I'm not sure if the "rewiring" of her chess memory was intentional, or if it was just a case of the brain adapting (probably the latter).
They once did an experiment where they sat outside with her and a truck drove past with a particular chessboard configuration on the side. She glanced at it, then recreated the entire board in a few seconds. Then another truck drove past with a different configuration and she couldn't recreate it. She remembered the first one because it was from a game she'd seen before. She'd never seen the second one before so she couldn't remember it.
I think the story comes from GEB, but I've heard that good chess players (not even anything-masters) can recreate boards from actual games from memory much better than non-players, but are no better than non-players when dealing with randomly arrayed pieces. The theory is that they can abstract out the few hints they need to put the majority of the board together when it comes from an actual game, but those abstractions don't exist in a random placement.
As an analogue, you and I can memorize speeches relatively easily in our native tongues (I would suppose it's fair to say we're domain experts in the languages we know), but it's not easy at all to memorize and repeat (a) random strings of sounds, or (b) sentences from languages that don't have any common base with the languages we know.
This is the classic Chase & Simon (1973) article. Similarly, programming skill has been described as being based on the ability to remember abstract solutions (programming schemas e.g. Davies, 1994; Détienne & Soloway, 1990; Soloway, 1986) and applying them. From the perspective of a non-programmer, a program is just a wall of text. I remember someone did the same basic experiment with program fragments (real vs. random) and got similar results.
Experts can write the focal elements (e.g. pseudocode) first and then expand them into a full program. A good example might be the fizzbuzz test, or generating the permutations of a string, you'll have an idea of what the problem involves because you've done it before. If you can't visualize the problem in terms of something familiar, you'll have a hard time taking a top-down (e.g. memory-recall-based) approach.
They once did an experiment where they sat outside with her and a truck drove past with a particular chessboard configuration on the side. She glanced at it, then recreated the entire board in a few seconds. Then another truck drove past with a different configuration and she couldn't recreate it. She remembered the first one because it was from a game she'd seen before. She'd never seen the second one before so she couldn't remember it.