TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: When do you refactor?

1 pointsby rhlalaalmost 8 years ago
I consider it is almost impossible to give perfect names on the first shoot, so there are few option available, make it &quot;on the fly&quot; as soon as you see it might be good, but it cuts the &#x27;building&#x2F;make it work stuff&#x27; momentum, and i feel i dont get enough global view for take the good refactoring decisions,<p>Right now i try to take one full day of work each week only refactoring, good habit?<p>Maybe i will try do it everyday before continue work, refreshing yersterday code by refactoring seems good idea,<p>When and how do you refactor your code?

3 comments

ninjaofawesomealmost 8 years ago
One full day a week is a great start, we had &quot;refactor fridays&quot; at one of my previous jobs.<p>I&#x27;d say for me, its when I can see that I can make something more efficient or spot obvious mistakes or slipshod code. So it could be once a week, once a day, once an hour.. or months later when I come back to something and see that I could approach it differently.<p>Regardless, I like where your thought process is going on this, that you&#x27;re always looking to make your code a bit better whenever you can. :)
davelnewtonalmost 8 years ago
When? The second time I start typing almost the same thing.<p>If I <i>anticipate</i> typing the same thing again I&#x27;ll prefactor and head it off at the past.<p>If you can get official refactoring time that&#x27;s great; I&#x27;ve only worked at one place where we had official refactoring time built into our sprints, which can be frustrating.<p>&quot;How&quot; is impossible to answer in a general way other than restating all the usual refactoring patterns.
dozziealmost 8 years ago
My trigger is when I realize that I&#x27;m trying to avoid working on&#x2F;with a particular subsystem (usually because it feels brittle or complicated or difficult).