var x = 2; // value and identifier
// ...
y = x ** 2; // state!
Each class should have one and only one reason to change
class MerchantManager
{
public recalculateSalesLimit(merchant: Merchant): void
{
const salesForPreviousMonth = this.orders.salesForPreviousMonth(merchant);
const salesLimit = Math.max(
MIN_SALES_LIMIT,
salesForThisMonth * 1.5,
);
merchant.setLimit(salesLimit);
this.notifier.send(new SalesLimitUpdated(merchant, salesLimit));
}
}