This is a chicken-and-egg scenario. Do puzzle games keep your cognitive abilities sharp? Or does programming? I figure that for most people, it's the puzzle games, because they're NOT programmers. But for us, programming is just as effective. I'm solving puzzles all day long, and my mind has a hard time winding down at night.
As for puzzle games, though, I prefer brain teasers. And, I like to take IQ tests just for the fun of it. Oh, and Portal. Definitely Portal.