[prev] [index] [next]

Copy-and-paste

Sometimes during implementation, you find yourself repeating the same sequence of operations.

In small programs, it's easy to use copy-and-paste.

Do not do this.

If you observe commonality, write a function.

Even better, do detailed design before implementing so that functions reveal themselves early on.