Skip to content

Dog Snog dot Blog

Web dev with bites and fleas

  • Blog
  • About Me

Tag: refactoring

The Iterate-and-Mutate Programming Anti-Pattern

Take a look at this small, typical code snippet: let car_ids = []; for (let i = 1; i <= 5; i++) { const car_id = `car-${i}`; if (car_is_empty(car_id)) { car_ids.push(car_id); } } return car_ids; I call this the iterate-and-mutate pattern. It comes up all the time in code. But every time we see it, … Continue reading The Iterate-and-Mutate Programming Anti-Pattern →

Robb Shecter 100% Geek April 23, 2020April 23, 2020 1 Minute
Create a website or blog at WordPress.com