Coauthored Books

How does coauthoring usually work? Who gets to be first on the cover? Does it matter?