Serial port in use and uploading sketches

I'd like to use all four serial ports on an Arduino Mega. As far as I can tell from my experiments all I need to enable me to use Serial and still be able to program the board is to have a relay or tristate gate between on the RX line of the Arduino (Pin 0) and the TX line of the device connected to the Arduino. When the board resets the relay / tristate gate will block access to Pin 0 from the external serial device and programming will succeed. When the program executes it will enable an external pin and the connection to Pin 0 from the external serial device will be made.

Does that sound correct?

Is there a better way?

BTW I'm not interested in software serial ports, only interrupt driven hardware ports.

Iain