When I read "Refactoring" as a junior dev, I thought inlining was strange since I had only thought of extract subroutine. That weirdness made me realize that all refactorings should be symmetric. Sometimes the inverse is too obvious to justify a chapter. Turns out there is a lot of power in asking "Can I reverse this?". The ability to inline can help a lot because it reduces the penalty for premature extraction.
Reversibility is the key difference between my take on refactoring & anything else I've seen out there. Every extract has an inline & both are useful & valid at different times. Book will cover this in detail.
Often when I need to understand a code. For debug, refactor or changing functionality. I open a branch and start inlining the code so it is in single file.
When I read "Refactoring" as a junior dev, I thought inlining was strange since I had only thought of extract subroutine. That weirdness made me realize that all refactorings should be symmetric. Sometimes the inverse is too obvious to justify a chapter. Turns out there is a lot of power in asking "Can I reverse this?". The ability to inline can help a lot because it reduces the penalty for premature extraction.
Reversibility is the key difference between my take on refactoring & anything else I've seen out there. Every extract has an inline & both are useful & valid at different times. Book will cover this in detail.
Inlining is something people should do more.
Often when I need to understand a code. For debug, refactor or changing functionality. I open a branch and start inlining the code so it is in single file.