Inline Temp
From CSSEMediaWiki
(Difference between revisions)
m (Reverted edits by Ebybymic (Talk); changed back to last version by Stephen Fitchett) |
|||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Basically inline temp is removing variables that have been created to store a value returned from a query and replacing it with the actual query. | Basically inline temp is removing variables that have been created to store a value returned from a query and replacing it with the actual query. | ||
This leads to much clearer code (arguable) and less code. | This leads to much clearer code (arguable) and less code. | ||
Line 12: | Line 4: | ||
boolean payTax(int payRate) { | boolean payTax(int payRate) { | ||
int wages = payRate * hoursWorked; | int wages = payRate * hoursWorked; | ||
− | return wages | + | return wages >100; |
} | } | ||
Line 18: | Line 10: | ||
boolean payTax(int payRate) { | boolean payTax(int payRate) { | ||
− | return (payRate * hoursWorked) | + | return (payRate * hoursWorked) >100; |
} | } | ||
This is the opposite of [[Introduce Explaining Variable]]. | This is the opposite of [[Introduce Explaining Variable]]. |
Latest revision as of 03:07, 25 November 2010
Basically inline temp is removing variables that have been created to store a value returned from a query and replacing it with the actual query. This leads to much clearer code (arguable) and less code.
boolean payTax(int payRate) { int wages = payRate * hoursWorked; return wages >100; }
Using inline temp
boolean payTax(int payRate) { return (payRate * hoursWorked) >100; }
This is the opposite of Introduce Explaining Variable.