Are you reorganizing in small steps?

After reading Fowler's "Refactoring" for a while, I still often catch myself thinking: "I had to do it in small steps." - even when I did not break my code.

Refactoring in small steps is safe, but takes time. This is a compromise between speed and risk - I try to be strategic in choosing a refactoring method.

Nevertheless: most often I do refactoring in big steps. If I take part of Fowler’s “Mechanics” section and compare how I work, I may find that I often jump two or five steps forward immediately. This does not mean that I am a refactoring guru. My code may remain broken or incompatible for 5-60 minutes.

Are you reorganizing the smaller steps and trying to create indestructible code at shorter frequencies? And: do you succeed?

+5
source share
10 answers
Marcus Fowler seems to be leaning toward a small, gradual approach to refactoring. However, after reading his book, he sometimes takes some decisive steps, but only with unit tests for backing up code.

- . , , " , ". . , . , . -

+6

:) , , . , - . , "" . . -, . , , , .

+4

, . , - , .

, , . , , . .

, , . , . " " . , .

, , . " , ". , , - , .

, "" , X , . , , - 6 . , . . , , . , , , .

.

+3

, . " ". , ...

+1

", , ". , , .

0

, , , .

60 , , . . .

0

, , , , .

, .

0

, . , , , .

, , , , . , , , , , .

, , , .

, , , . / , . , , , , , .

0

- , , , , . - (, ), , , . , .

NB. , , , . , - 50% - , .

0

Yeah. I like to run tests all the time, and so the chain of tiny refactors works well. I feel uncomfortable if my code breaks down for more than a few minutes at a time, and I generally return if my code breaks when I get home at night, rewriting the next morning ALWAYS works better than trying to pick up I was.

0
source

All Articles