Batteries last much longer with proper care. If they take water, keeping them filled with distilled water is important. Also, it's not good to keep them under constant charge. Lead-acid type batteries actually last the longest if you keep them between 30% and 70-80% charge all the time. That's not necessarily practical for most of us, but the best way to maintain appropriate charge levels is frequent riding!
Obvious stuff like keeping corrosion off terminals and cables in good condition will also help.
The two quickest ways to kill a battery are:
1) let it run out of watter
2) let it drain to 0 charge