No matter what method you use to cook your corn, never overcook it. Corn at its best is very milky inside and should retain that moisture when heated. If overcooked, it will dry out quickly. Also, despite what you were taught, never salt corn before cooking. Salt pulls out moisture from any food and, again, the corn will dry out when cooking.
Some people like to add a little sugar when boiling corn.
I do that too, although there are some varieties of corn that are so sweet it isn't necessary. Then I drain off all but a little of the water and keep it on a warm burner, partially covered, until needed. It never overcooks. I never completely cover the ears with the water which is why they don't overcook. I do turn them over once through the process.