But I would challenge the idea that complex programming problems (cloud sync, NLP, etc, choose your poison) can be solved equally well in a suboptimal environment. Here is my "hypothesis": unregulated noise[1], temperature[2], and other travel-centric environmental factors (such as the need for vigilance in a new environment) distract from cognitive performance in the majority of people, if not all people.
[1] http://peterhancock.ucf.edu/Downloads/ref_pubs/Szalma_Hancoc... [2] http://onlinelibrary.wiley.com/doi/10.1111/j.1600-0668.2004....
To be clear, I don't think it is possible to write my best code in a park, an airplane or a café, regardless of mood. But I would be curious to see relevant studies which demonstrate otherwise. I agree that changes in environment are stimulating and that stagnant workplaces hold their own dangers.
I also agree that 2-3 months is a good baseline for getting to know a place: you don't feel as jostled about by your schedule, and there may even be time for cursory grasp of the language (w/some prepping beforehand) and making a friend or two. Plus you don't have to cram your (potentially expensive) excursions into as short a block of time.