Our swim club teaches them from 6 months. Keep the pool. If you get a cover, it must be 100% childproof, because if they get under the cover, you can't see. Better to get the code lock as you suggest and teach them young. also teach them to stay away without an adult, just like you do for the street. maybe add an easy ladder out for them, just in case they disobey. I say they advisedly

/mysticmeg