To avoid overcooked pasta, cook it until it's just al dente, as it will continue to soften slightly when you add the cheese and let the dish rest. Also, stirring occasionally during cooking helps maintain an even texture.