I prefer to use braided Sharkbite hoses to the tank, so the tank can be moved if needed. I use CPVC stubbed out from Pex A ( Uponor ) on threaded couplers. I use threaded ball valve stops on both the cold and hot Pex supplies, before the CPVC. I don't use Sharkbites anywhere else and don't recommend them elsewhere. The water heater uses a pan that drains outside. No idea if that meets code, but works for me.