1) Cube Farms in large corps 2) Private offices for everyone in a startup founded by Microsoft alumni. 3) Team Rooms of 3-5 people max. 4) Large open areas with no cube walls at all. 5) Working from home (what I do right now)
Based on this experience, I think the optimal solution is the 3-5 person team room. It works well because it allows for a high degree of collaboration while keeping folks outside the team at arms length to limit distraction. In this environment, we shipped a working product written from scratch within 3 months.
Open plan offices were by far the single most distracting environment. Ironically, I was at the same company when we switched from a 3 person team room to an open floor plan to cut costs. The productivity hit was enormous.
Cube farms are actually better than open floor plans. They're far less impressive and drab, but the cube walls serve as a minor barrier to interruption since they require getting up and walking to make eye contact.
Working from home is great for productivity as a single programmer, but collaboration is more of a challenge, and it requires solid leadership capable of defining problems very clearly and staying focused. That's a tall order for most startups where the ground is constantly shifting.
Private offices were great for a single programmer working on a well defined problem, but difficult to foster the right collaborative environment. It's hard to institute concepts like pair programming and code review under this setup.