|
|
|
|
|
by ndesaulniers
3808 days ago
|
|
1. Unit tests. Otherwise modifying old code is full of potentially unforeseen landmines. 2. Read the function a few times to get a sense of what it's doing. 3. Break the function into blocks of statements that are performing a related task. 4. Factor those out into smaller functions. 5. Recursively repeat 3-5 until you're satisfied with the new functions' line count. > Should I tell my manager that the function needs to be refactored and take time to refactor it? It's absolutely worth mentioning. Time estimations are one of the harder tasks of Software Engineering. Being up front with your manager can help better set expectations. |
|