Rule of Three


It’s OK to have two instances of the same code, but three instances should be extracted to avoid duplication.

Wikipedia