Inline function / Inline method


Identify a function or method which you would like to replace with its body in some or all of the places it’s used.


If you plan to remove the original function or method, you should make a list of all the places it is used so you can go through and inline them one by one. If you only want to inline some usages, then you probably don’t need to.


If that doesn’t work, these are some manual steps:


Follow up

If you have inlined something in a lot of places you may have created duplication. You may want to extract a new method for some or all of it.

Prompted by Code Smells

Relevant Learning Hours


Back to All Refactorings