How much do you polish/refactor your code?

Do you take a lazy approach and quickly put together a feature and if it works you move on? Or do you refactor things to ensure you are following good standards that will make your life easier in the long run?

Perhaps it depends on the project? Your mood? How much you like the company?

1 Like

I personally like stay focused on the task at hand. If I’m working on feature, I like to finish the feature before refactoring. Since code pretty much NEVER shows up like I want it, I will leave TODO tags in the code and come back and refactor later. The days where I know that I won’t have a long stream of uninterrupted time to concentrate is the perfect time to chase down those todo tags and refactor and clean up code.

It’s not bad now since I’m working from home but in the office there were so many interruptions that it seemed like the only thing I could do is refactor code :wink:

3 Likes

I litter code with TODO’s too :laughing:

I like how most code editors recognise a todo, and highlight it accordingly:

Screenshot 2020-07-09 at 15.42.40

2 Likes

I tend to follow TDD principles pretty strictly, speak the red, green, refactor cycle. It works really well for me.

It took some time getting used to it but now I always feel weird when I don’t write the tests first. Sometimes that’s necessary, especially when prototyping and experimenting, when you not yet know where exactly you’re going. But beyond that it’s TDD all the way.

I’m also really strict on naming. In the best case the code reads like prose. After all we as developers spend most of our time not with writing code but with reading it, understanding it. So I feel like the upfront investment is definitely worth it, to help with understanding down the line.

It’s easy to write code a machine understands, it’s hard to write code a human understands.

4 Likes

I try to turn in clean and correct code the first time, because it’s annoying to have to redo things.

2 Likes

Personal projects: as much as my heart desires.

Professional projects: I learned to stay focused but make extensive notes on the side about future improvement potential.

2 Likes