Inline Method

From CSSEMediaWiki
Revision as of 03:22, 25 November 2010 by WikiSysop (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This is basically the opposite of the Extract Method where you replace method calls with the body of code

Sometimes the body of a method is as clear as the method name. Replacing the method call with the body of the method can help get rid of needless indirection.
Another time to use the inline method is when you have a group of badly factored methods. By using the inline method you can construct one big method then reextract the methods.

Automatic Inlining

An Inline Method can also refer to automated inline functionality in some languages. For example in C++ a method can be declared using the inline keyword. A method declared inline will upon complication be copied into the locations it is called from. This reduces overhead by eliminating function calls but increases binary size. Inlines are often used in high performance low level code.


Personal tools