Can of worms.
I'm probably opening up a can of worms but, TANKLESS!
If you decide to go tankless, do your research first. Tankless heaters are small, highly energy efficient, and can qualify for a $300.00 tax incentive of sme kind. As long as you do not exceed the rated capacity, in galons per minute of hot water production, you will NEVER run out of hot water, so take a shower as long as you like, even when you have company. Tankless water heaters have no tank full of water, so there is no chance of the heater having a burst tank, or a sediment and deposit filled tank. Unfortunately, tankless water heaters are expensive to buy (but very VERY cheap to operate). Not all plumbers are familiar with tankless water heaters, though they are getting more and more common, so ask your installer to be sure they know what they're doing. Tankless water heaters are available as electric or gas, so get what you need.
How they work:
A tankless water heater has an inlet and an outlet. There is a flow sensor in the pipe which detects when water flows through the unit. When it detects water flowing, it switches on and makes hot water. When the flow stops, it turns off. When you don't need hot water, it isn't running, keeping 40 galons of water hot all the time. It only switches on when you need it.
There are 2 things to remember!
#1 get a tankless heater that senses the temperature of the output and keeps it constant up to its rated capacity. This is to avoid getting a water heater that will scald at low-flow and freeze at high-flow.
#2 make sure you get a heater that can produce the galons of hot water per minute you need. Tankless heaters are rated in galons per minute of hot water they can make. Most manufacturers have calculation charts which you can use to determine the flow each type of application uses. A shower is usually the most, and a sink if often the least. Find out what your needed capacity is (Do you want to be able to run a shower, the dishwasher, the washing machine, and a sink at the same time?
The company where I work uses tankless water heaters exclusively and we have had no bad experiences.
Good luck,
Dave