This is what I do, as it's been recommended by the manufacturer:
- Unplug the computer when it's not on (so that it's not constantly trying to charge the battery).
- Keep the battery in the computer when it's on, but plug the computer in (so that it maintains a full charge for when I need it, but it gets charged slower).
I've lost less than 5% of the battery's capacity over the past 9 months that I've had this laptop this way. My wife's laptop battery however, has been pretty much wiped out over the past 3 years.
If however, your computer is always at your desk and you never take it mobile, then it's probably best to remove the battery entirely because you don't use it. Drain the battery to between 40 and 60%, then put it in the refrigerator. It will permanently lose 2% of its capacity over the course of a year if you do it this way, versus 20% if you keep it fully charged at room temperature.
Lithium ion batteries can generally survive for 1000 or more cycles, and a partial cycle only counts as a partial cycle, unlike (much older!) NiCd or NIMH batteries, which can build a memory effect.
By the way, to respond to another poster, the Tesla manages its battery pack much differently from a laptop in order to extend its life. That pack is never charged to full capacity (I believe 80 or 85%) and never allowed to drain less than 20%. Laptop users are much more picky about discharge times, and their manufacturers much less worried about how many years the batteries last than they are about selling more laptops than the next guy. Also, the battery pack they're using in the production cars are of a different chemistry than their original prototype (which actually used laptop batteries), for safety.