There’s a lot of power in clean code. Clean code might not become better over time, the same way that a fine wine would, but at least it remains understandable as time goes by.

Spaghetti code, on the other hand, the more time goes by, the worse it becomes. You might be able to handle the chaos for now, but what if you work on something else and come back to it three, five, or 20 months later?

One of the main principles I like to stick to as a programmer, including in Vue.js projects, is the DRY principle.

DRY stands for don’t repeat yourself, and its goal is to reduce repetition.

The reason why I insist it’s important is that WET (write everything twice) solutions tend to introduce additional complexity in many cases. I’ll share a simple example to help you understand.

Let’s say you have duplicate code in two places in your code base. What if you decide to change the logic or some of the parameters? You’ll have to refactor your code in both places. How bad can that be, though?

#javascript

5 Principles for Writing Clean and Maintainable Vue.js Code
1.45 GEEK