Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagegroovy
final rounderroundingUtils = libs.MathLuib.RoundingUtils

final someNumber = ...

rounderroundingUtils.round(someNumber, 2)

This practice dramatically improves the readability of your code as it grows in size.

Tip

Do this:

Code Block
final productsproductUtils = libs.ProductLib.ProductUtils
final pricingpricinUtils = libs.PricingLib.PricingUtils

final product = productsproductUtils.getProduct(...)
final cost = productsproductUtils.getCost(...)
final margin = pricingpricingUtils.getMargin(...)

final listPrice = pricingpricingUtils.calculatePrice(product, cost, margin)

...

Warning

Don’t do this:

Code Block
final 

...

productUtils = libs.ProductLib.ProductUtils.getProduct(...)
final 

...

costUtils = libs.ProductLib.ProductUtils.getCost(...)
final 

...

marginUtils = libs.PricingLib.PricingUtils.getMargin(...)

final listPrice = libs.PricingLib.PricingUtils.calculatePrice(product, cost, margin)