Water heaters typically last around ten years, whether they are gas or electric. Keeping a regular maintenance schedule on your water heater can extend it's life by another ten years. On demand water heaters are trickier to service yourself. Though they are more energy efficient, they need to be looked after by a professional.
If you just have a regular storage heater, you can really do a whole bunch to keep it in top condition. Storage tanks heat stored water that is moved to various places in your home through your hot water taps. Gas heaters have vents to get rid of excess gas, but electric heaters do not. You'll find that you can stay ahead of problems with your water heater by engaging in some easy preventative measures.
Hard Water Problems
Hard water may seem like a non-issue, but it actually leaves a bunch of lime scum on your heater, limiting it's efficiency. You may want to buy a water softener that will take icky deposits out of your water before it reaches your heater. Water softeners cost about the same as a new water heater, but they can save you money on a whole bunch of other problems. Lime scale tends to build up around the whole house, which can cost a bundle.