Create templates to quickly answer FAQs or store snippets for re-use.
I mostly refactor things if i decide to go back and add a new feature or fix a bug i found. It usually goes something like "who wrote that crap? oh, right, me...i need to fix that" and then i spend two days cleaning stuff up and then finally adding the new feature :)
Lol, I can relate to "who wrote this crap?"
I do refactor my project,
most the refactor I do is when I need to add new features and I see the code that integrate with my new feature and I understand that my "now" knowledge is better than what I had so I do a little refactor,
What that helps my do all my refactor is thick layer of integration tests that tells me if I broke something
And I'm writing a new blog post about a half year refactor I did in one of my team products
I do refactor personal projects, e.g. paste, or my blog's SSG.
It's usually because the maintenance burden becomes too heavy, or it becomes too hard to implement new features.
I do, for one of two reasons:
Refactoring a project is learning a new skill.
Refactoring a project is a skill in its self? Or to refactor means you've learned new skills?
Well, both of course.
I get tired of the argument that "you ain't gonna need it".
It's important that we always refactor our code. Even if we never touch it again, the process itself is the most important part.
The skills we pick up as we refactor our code makes us more efficient at spotting opportunities to refactor and at quicker at implementing the changes.
Once you start refactoring everything you start to notice the consistencies in your codebase then you can decide whether or not it's worth abstracting them away.
Sure sometimes you can take an abstraction too far but you'll never know whether it's worth it or not without a lot of practice and experience.
The only way to get that is to refactor everything all the time.
I decided to refactor my side project from April from bootcamp. It was the first time I did anything with Rails and CSS and it shows - CSS is a mess. I genuinely like the project so decided to give it a new life. I wrote a plan for myself and wrote about it here:
I’ve been coding 10-75 minutes a day this holiday break. I see I’m learning a lot, also because I give myself space to go down the rabbit hole of docs and stack overflow threads :)
When I initially wrote my library to access StackExchange Api's, it was just working and the code was super trash. I again refactored it in a much better way. Have a look here
Yes and no.
I only refractor when;
Often, it is more that if something wasn't developed fully, it is new code, so little refactoring occurs.
It is definitely the case there are some awful parts to my code, but typically they are fire and forget.
I do refactor my projects, principally because if you learn something new every day, some new framework or some new pattern and refactor your personal project is, I think, a great way to improve your understanding on those.
When I want to add something new to my project, I take a close look at everything on display to the user, and focus on making sure what’s already there is working as well as it could.
I usually find that there’s stuff I’ve already done, which I haven’t done as well as I could :)
I haven't yet, although there are a few things I would go back and refactor if I was going to work on them again.
It has only just now occurred to me that I don't even use my old projects. Personal projects have mostly been from school or while I was learning something.
Refactor my personal project?! Yes, I do that alot. Sometimes to convince myself it's better than writing tests for a personal project. 😅
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.