Skip to content

Repository files navigation

Upcase Refactoring Trail

Explaining Variable

Refactoring exercise using the Extract Variable refactoring for the Upcase Refactoring Trail.

Extract Variable

Put the result of the expression, or parts of the expression, in a temporary variable with a name that explains the purpose. -- Martin Fowler

Before

deftotalamount + (amount * TAX) - (amount * (discount_percentage / 100.0)) + (amount * (tip_percentage / 100.0))end

After

deftotaltax=amount * TAXdiscount=amount * (discount_percentage / 100.0)tip=amount * (tip_percentage / 100.0)amount + tax - discount + tipend

About

Extract Variable refactoring

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages