TUAW ends this article about laptop batteries with this advice:

Never leave the machine plugged in all the time. Laptops are meant to be portable. Using it as a desktop that never runs on the battery will destroy your battery life. Cycles are your friend. Never letting the battery complete a cycle will greatly diminish your run-time. Try to avoid charging the battery unless it’s drained past 30%. Any time the battery drains past 50% and charges more than 50% counts as a cycle. The farther you let it drain before the charge - the better its overall health will remain. 30 cycles in a year is not a good thing. ;) Let the battery drain completely a few times a week. Never let it sit for long periods of time without use. Batteries need to be loved or else they won’t love you.

Most* of these tips are incorrect for the lithium-ion (and, more recently, lithium-polymer) batteries that are used in nearly every laptop manufactured in the last decade.

The “memory effect”, or the need to “refresh” or “deep-cycle” the battery by completely discharging before recharging, is stale knowledge from the time of NiCad and NiMH batteries. Lithium-ion batteries don’t suffer from the memory effect.

It’s also not bad to leave your laptop plugged in. In fact, it’s a good thing to keep it plugged in whenever you don’t need to be running on battery power.

* Update: Apple recommends that you run it on battery for a while at least once per month. It’s pretty difficult to own a laptop and not do this, but it is an edge case that some people achieve. So I’ll amend this: You shouldn’t technically leave your laptop plugged in all the time, but you certainly don’t need to deep-cycle it “a few times a week” as the TUAW post states. Furthermore, the recommendation for monthly battery usage isn’t just for capacity preservation: it’s mostly so the charge indicator can maintain accuracy as the battery’s capacity decreases naturally over its lifespan.

With that said, here’s how lithium-ion batteries behave.

Due to their chemistry, their capacity slowly diminishes with age. Laptop batteries usually lose most of their useful capacity 2-3 years after manufacture (not initial use). The new lithium-polymer batteries in the MacBook Air and unibody MacBooks (only the non-removable ones) claim to have improved this, but it’s too early to tell if these claims have merit. Assume that most laptop batteries will need to be replaced after a few years.

If you use the laptop on battery power a lot, the battery lifespan will be shortened. This “wearing out” effect is much less severe than with older battery technologies, but is still present. This is why you should plug it in if it’s convenient.

When plugged in, the battery is not in use. The laptop’s power circuitry bypasses the battery unless it’s needed. Depending on how smart the charger is, it may occasionally poll and “top off” the battery if its charge decreases to a certain threshold below 100%, but this is rarely needed in practice.

If the battery is not in use, it will slowly lose its charge due to all rechargeable batteries’ tendency to slowly self-discharge. Lithium-ion and lithium-polymer batteries have the lowest self-discharge rates of any common battery technology, estimated at less than 1% per month and difficult to distinguish from the loss of capacity with age.

In reality, if your laptop is closed, the battery slowly discharges with time because it’s not really “off”. A small amount of continuous power is needed to preserve the RAM’s state during sleep. It’s not the battery wearing out — it’s being used, but much more slowly than when the computer’s in use.

When Apple decides whether a battery is defective or has been worn out normally, the “special utility” they run is System Profiler. You can run it, too. Check the Power section, and it’ll tell you your battery’s cycle count, the intended capacity at manufacture, and how much capacity per cycle remains. Apple technicians compare the cycle count to the capacity loss. If your battery has lost a lot of capacity in its first year but hasn’t performed enough cycles to reasonably correlate to the capacity loss, they’ll replace it under warranty.