FOR most of my professional life, I have worked from home. The freedom to work outside a traditional office was one of the main reasons I left the corporate world eight years ago, at age 23, to start a software company.

The idea that all employees should sit in the same place for eight hours a day, five days a week, seemed maddeningly inefficient to me. I knew that I was at peak productivity at certain times throughout the day, with regular lulls in between. The flexibility to determine when and where I worked made me a better worker.

But as my company grew, something surprising happened: I started to feel the pull of the office. As an employee, I still had little desire to spend all of my day there. As an employer, however, I wanted to ensure that my employees were working efficiently. Requiring everyone to be in the office for at least part of the week seemed the easiest way to do that. I also saw the value of the conversations that arose when people were physically together in a room.

When I heard last week that Marissa Mayer, Yahoo’s chief executive, was banning its employees from working at home, my first thought was, “I’m glad I don’t work at Yahoo.” But I also understood why she felt compelled to enact the policy, at least for now. She is in charge of a huge company that is known for its bloat. This may be exactly what Yahoo needs to get back on track. The question is whether the policy will improve productivity in the long run.