Refactoring: when do you know this time and when do you do it?

When do you know the time to refactor / view some piece of code? And better yet, when will you do this?

Probably, like the others, I found that I know that something needs a refactor / review, but the timing and management did not leave time for this. I would also like to hear how you include code review in the overall development process.

Recently, I found myself doing this before working on new features / code. For example, if I need to develop or change something in the module X of the application, I review the code on this module. I found that this also helps me better understand the module so that I can make changes easier.

So when do you know this time and when do you do it? And most of all, how do you include it in project planning?

+5
source share
16 answers

I tend to “smell like” as I repeat the same code over and over, or I see something that makes me think, “There must be a better way to do this, and I'll go find it.” This is part of how I write code and I think it’s a good idea to have good code that can take a little longer, but it is much more easily scalable, supported, or someone else will take it and it won’t have to spend days. figuring out what I was doing in code.

, , , :

1) . , . , , , .

2) . , , , , , , , , .

+4

- , , . , . , .

, : , , . , , . , . -, , . -, ( ) . -, unit test, , .

+10

TDD - Red-Green-Refactor: , , , , . , . , , . -, , . , , - , .

+6

- , , , . , , - , .

, . , .

+2

, : ! , , , . TDD, , .

+2

+2

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

0

, , - , .

, , , , , - , - , , .

0

: , - ( , ). , , .

, .

, , - ( , ).

0

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

, , , . , , , . , , . , - .

0
  • (, , ..), , , , .

  • .

  • , , , .

( , , ..).

0

( , ), . . , , .

0

- ( 6 ), , , , .

, " ", , , , . , , , , .

0

, . , , , , - .

, , . , , , .

, , - , . "" ( , ), . , / , ...

0

, , . , . - , ( ).

, . : 1,2 3 . , 4 5. , 6 - .

.

0

: , , - , , , , - , , .

, . , "". , , , ""?

!

0

All Articles