Promptles
Programming Basics

Refactor

intermediate

Definition

Rearranging code so it is easier to read and change, without changing what it does for the people using it.

In the wild

One long checkout function gets split into three smaller ones for prices, discounts, and receipts. Customers notice nothing, and the existing tests still pass.

More from Programming Basics