👉 Controversial opinion: you don't need to always follow DRY principle.

Here are some reasons

đź§µ
1 / You can't see the whole picture

For example, you don't know yet will you use your code or not, since you're just trying things out, making experiments/researching.

There is no need to make your code clean and exceptionally DRY: it might happen you'll remove it soon.
2 / Your customer doesn't yet know what he wants.

This is very similar to when UI designers first do some prototypes/mockups.

Today you make your code perfectly DRY, tomorrow you show the work to your customer and he says: no, I decided it won't work, we need something else
3 / Your copy-paste is actually 3-4 lines of code.

Don't go mad with DRY:

- if you have 10 site sections,
- in every section, you need to get a list of users,
- the repeated code is actually function name + API call
with 3-5 lines of code.

then it's not copy-paste.
You can follow @vponamariov.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled:

By continuing to use the site, you are consenting to the use of cookies as explained in our Cookie Policy to improve your experience.