This question already has an answer here:

I'm currently interning at a company where I've been tasked with building an application from scratch. I've been working about 8 weeks, with 4 left to go. I've written a lot of code in that time, but now as I go over it, I'm realizing that it's really quite inefficient, ugly, and going to be hard to maintain for whoever gets this after I leave. I only have a few things left to implement, but I feel like I should place a higher priority on making the code better for future developers before I keep adding to it. Given my timeframe, is it more worth it to finish and then refactor, or refactor now and add afterward?

marked as duplicate by user40980, user22815, durron597, gnat, user53019 Jul 15 '15 at 20:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 4
    Talk to your manager. Your priorities and timelines (and what they're going to do with the code after you leave) are up to your manager. – user40980 Jul 14 '15 at 0:26

We're the wrong people to ask.

You're writing this code for the company; essentially it is your customer. Someone in that company knows who's going to work on it next; someone has an idea of whether more features or more maintainable code have greater value for them.

You are your customer, too, in some ways - what do you want to get out of this? Pride? Experience? Education? Usually an internship involves learning something - it always should - what do you want to learn? Four weeks from now, when you leave, how will you feel about the project? One of the things to learn is the importance of communication - communicate your concerns and your questions to the relevant people at the company, and see how that works out.

  • But he's part of the company as well, and many small companies have no clues about their future direction and murky command chains. If he really had this amount of guidance he wouldn't ask here, probably. My guess is he's left all alone in the obscurity. – ZJR Jul 14 '15 at 0:49


This is your priority. This is all they care about. This is what you've got to do.

If you get to deliver something that you feel has a sense of quality to it, you'll fell better and work better, and see a future for yourself in that company.

But you have to be realistic about time constraints. Do you have first hand experience of refactorings? Can you really do what you think you could do? Or are you overestimating your energy and commitment and underestimating the troubles you will run into?

Be pessimistic, consider that a refactoring might take 4 to 8 times longer than you feel it might. If that much more time would still get you to deliver on a reasonable schedule, go for it. Otherwise take the cheap messy shortcut: repurpose the crappy code you're dealt with and die another day.

Choose your battles wisely. Most ain't worth the hassle.

Not the answer you're looking for? Browse other questions tagged or ask your own question.