Re:100,000 e2e selenium tests? Sounds like a nightmare
by Retric on Wednesday May 14, 2014 @04:23PM
(#7746144)
The term refactoring dates back at least to the 80's well before TDD showed up and it was used as a shorthand for cleaning up code without the focus on tiny changes. More importantly bugs are often related to side effects such as how long a method takes as such using even one more or one less cycle any any code path prevents code from being 'pure' in your definition as it may add or remove a bug as would changing it's memory footprint etc.
Granted, that may seem pedantic but if you look closely you realise nobody uses your 'ideal' definition in practice.
PS: Feel free to use / introduce new terms such as 'Pure refactoring' but understand they don't change what refactoring actually means. As to popularity wikipedia's "does not modify its conformance to functional requirements" suggests that's the commonly understood definition.
Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure.
You correctly identified a consequence of this in your later comment:
> In your definition if you introduce or remove a bug your not refactoring.
That is indeed the case.
And also correctly observed that:
> realistically for any sufficiently large change bugs can and will be both added and removed.
If a change adds or removes a bug, it was not a pure refactoring. It may have been an attempt at a pure refactoring, and it may have been otherwise successful, but the introduction of a change in behaviour means that it was not purely a refactoring. This isn't necessarily a bad thing - i'd rather bugs be removed than not! - but it's possible to distinguish the refactoring and bug-fixing aspects of the change. Ideally, i would like to see those aspects formally separated, for example into separate commits in source control. But even if not, we can at least use the terminology correctly and precisely.