I think this is a very good way to get a quick idea of how a new language works. No theory, no blabla, just the code in a language you know well side by side with the new one.
It actually works well with spoken languages: I've done that by buying the same book in my native language and a new one for which I know only the basics, with great success (and perseverance).