MICHAEL MUNGER, the jocund chair of the Duke University department of political science, has published a lucid and charming explanation of the theory of the firm. Firms are little command and control structures involving lots of central planning. If markets are so great, if allocating resources according to price signals is so efficient, then why have firms at all?

So, one day the boss has this crazy thought. He asks himself a question that has never occurred to him before: Why have any employees at all? Why have a building? Why not just sit home, wearing his jammies and bunny slippers, sipping a nice cup of tea, and outsource everything? He can write contracts to buy parts, he can pay workers to assemble the parts, and he can use shipping companies to box and transport the product.

If you suspect this will not turn out well, you're right, and Mr Munger explains why:

The cost savings from division of labor would be swamped by the increased cost of negotiating and carrying out transactions, and monitoring quality. That's why the "firm" is not really a market at all.

The ideal of socialist planning is a giant, nation-sized firm. So hey, why not? Because just as total outsourcing is inefficient, so is total insourcing. Efficient firms require market competition to find the ever-shifting sweet spot.

All firms use some combination in-house work and outsourcing (no computer company makes its own furniture, grows the wheat for bread in the employee cafeteria, or makes waste paper baskets). Where is the line? How does the company decide what to buy, and what to produce? The answer is: profits. The company has to decide which approach, at every stage, costs less, improves quality, or in some other way increases profits.

Of course, the line changes constantly as new technology changes the costs of various form of contracting, coordination, and monitoring. That is one important reason why companies that become too comfortable in one mode of organisation and management are certain to eventually take a beating from more nimble competitors.