> For the complete documentation index, see [llms.txt](https://nicologies.gitbook.io/awesome-programming-knowledge/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nicologies.gitbook.io/awesome-programming-knowledge/writing-better-code/books/refactoring-improving-the-design-of-existing-code/quotes/the-rule-of-three.md).

# The Rule of Three

Here's a guideline Don Roberts gave me: The first time you do something, you just do it. The second time you do something similar, you wince at the duplication, but you do the duplicate thing anyway. The third time you do something similar, you refactor.
