Task 2 – Utilizing ROP for validation and processing
Steve has a workflow that involves parsing, validating, and processing an enemy spawn. Refactor it using Railway-Oriented Programming (ROP) to improve the error-handling flow:
public void ProcessEnemySpawn(string enemyData) { var parsedData = ParseEnemyData(enemyData); if (parsedData.IsValid) { var validation = ValidateEnemySpawn(parsedData); if (validation.IsValid) { SpawnEnemy(validation...