DEV Community

loading...

Discussion on: Golang through the eyes of a Java developer - pros and cons

Collapse
alainvanhout profile image
Alain Van Hout

I'm curious. Refactoring is a completely deterministic process that requires some effort and attention to detail but no creativity. Because of that, it's also easy to make mistakes by forgetting a detail or due to a copy/paste error.

In other words, it's a perfect task to be automated. In what way do you not get it exactly as you want it, when e.g. extracting a variable or a method?

Collapse
marcello_h profile image
Marcelloh

Refactoring in my eyes is not only to move parts of a complexer function out of there, but rethink why the function was complex in the first place. This kind of refactoring cannot be automated.
I daily check my code for complexity of functions (automated) and refactor when I spot a candidate, because then, it's still fresh in my memory.

Thread Thread
alainvanhout profile image
Alain Van Hout

That sounds reasonable, and obviously not something a computer can do for you.

I tend to use the term 'rework' for that, while sticking to the traditional meaning for 'refactor'. But as long as all parties understand what is meant, that doesn't really matter 😄.