loading...

How do you refactor personal projects?

twitter logo github logo ・1 min read

Perhaps a better question is do you refactor personal projects?

I can see both sides of this.

Refactoring a personal project to incorporate new functionality is a good way to show off new skills. On the flip side, learning new skills may be a better use of your time.

Do you ever go back and rework old projects? What do you look for when refactoring?

twitter logo DISCUSS (17)
markdown guide
 

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

 
 

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 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:

  1. I want to upgrade code to my new/better skills.
  2. I want to add some new feature (move project forward). You know, I have lot of projects in "it does something i want, but i have lot of features in mind to add there" state. Some of them i didn't touched for years. Now i have some time to move them forward - something like End of Year Resolution.
 

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 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

github.com/gethari/StackExchange.NET

 

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:
dev.to/sylwiavargas/refactoring-my...

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 :)

 

Yes and no.
I only refractor when;

  • something I did before needs enhancing and it becomes obvious it has become too complicated to extend/understand.
  • I find myself repeating the same code. Some code will move to a utilities library or generic.

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.

 

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.

 

Refactor my personal project?! Yes, I do that alot. Sometimes to convince myself it's better than writing tests for a personal project. 😅

 

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.

Classic DEV Post from Aug 14 '19

What Does Your IDE/Code Editor Look Like?

Shannon Crabill profile image
Software Engineer && Email Developer