Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

To improve readability, always assign the library element instances to a variable before using them:

final rounder = libs.MathLuib.RoundingUtils

final someNumber = ...

rounder.round(someNumber, 2)

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

Do this:

final products = libs.ProductLib.ProductUtils
final pricing = libs.PricingLib.PricingUtils

final product = products.getProduct(...)
final cost = products.getCost(...)
final margin = pricing.getMargin(...)

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

Don’t do this:

final product = libs.ProductLib.ProductUtils.getProduct(...)
final cost = libs.ProductLib.ProductUtils.getCost(...)
final margin = libs.PricingLib.PricingUtils.getMargin(...)

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