What would be the best way to prevent melanoma?

Avoid sun. Avoid excess sun exposure, especially if you are fair skinned or burn easily. If you are in the sun, wear sun screen with high protection levels. Don't use tanning beds.
Sunscreen. Limiting your exposure to uv radiation is the most important way. Never use a tanning bed. Wear sunscreen cover up as much as possible with long sleeves and a hat if you are going to be outside for prolonged periods of time. In addition see your friendly dermatologist for complete skin examinations.
Sun protection. The main risk factor you can control is sun exposure. Apply high protection sunblock early and often, and wear appropriate full length clothing as much as possible (clothing designed for sun shielding will keep you comfortable, cool and safe). If you have any suspicious lesions, get them checked out asap. Early detection of melanoma is critical to a good result. See www.Melanomafoundation.Org.