WET: Write Everything Twice
We have been conditioned that DRY (Don’t Repeat Yourself) has been the best approach for decades but there is overwhelming evidence of the contrary.
They say DRY save you a lot of time and it becomes easier to maintain code. This is a lie. There is nothing wrong with repeating yourself. Software is cheap. You can write something, throw it away and write a new one without any repercussions. This is a much cheaper approach because there is no commitment until you know what you are committing to.
DRY necessitates abstractions and this has led to very expensive mistakes and systems that cannot repaired because of the fundamental flaws of its designs.
Write everything twice. Then copy-paste it in as many places as you need to. But once you reached three, you may want to look at what is common. Extract it and create the abstraction. This is called Abstract after Three. But why three? Because in the world, you cannot know what two things share in common until you’ve seen at least three examples.
There is nothing inherently wrong with abstractions. What is costly is prematurely abstracting code based on imagined properties.
Duplication is cheaper than forcing abstractions.