I have a problem.
I drink waaaay too much tea.
But that's not the real issue. Not really.
After I'm finished steeping my tea to perfection, I forget to clean things up.
Dirty mugs, tea stained spoons, and tea pots with tea leaves still in them.
And the worst part?
When I want to make another pot of tea, I have to spend a bunch of time cleaning up my kitchen before I can even get started.
Writing software is exactly like making a cup of tea.
If you don't clean things up as you go, eventually it becomes difficult to get anything done.
The mess slowly piles up.
Bit by bit.
Byte by byte.
Without realizing what happened, you're forced to spend a day or two just cleaning up the mess before you can get to the real work.
But taking the time to clean as you go is hard.
Keeping the kitchen clean is somehow a monumental task.
Marie Kondo would tell you that you can't just binge a Netflix series, get hyped up, tidy your whole life, and then everything is golden and perfect from then on.
It's a continual process.
Setting aside time once a year to refactor isn't enough.
The company I work at used to do this, and it was great for tackling the big hairy messes everyone knew had to be fixed.
We got a month each year to fix these big messes.
But we also spent time continually refactoring.
We made sure that we were leaving code better than how we found it.
Code rots.
Over time, as people add more things to it, it gets worse.
It's not that it was bad to begin with. But small, tiny, incremental additions made it bad over time.
As soon as you realize the code you're working in is getting worse, take just a little extra time to make it better.
If you keep doing this your codebase will just get better and better.
It's like tidying your apartment as you live in it.
When you're done reading your book, you put it away.
After you get up in the morning, you make your bed.
And like me, I'm sure you would never leave clothes on the floor.
As for how to go about refactoring your Vue app, well, I'll leave that for another time.
But I'll share a few of my thoughts:
Trust your instincts.
You know what bad code feels like better than you think you do.
And you also know good code when you see it.
So find a piece that is too difficult to understand. Something that is overcomplicated.
Then break it down and make it easy.
Take something complex and make it simple.