In online shops there are areas with complicated rules. For example
- is a product visible in the product catalog
- is a product sold out
- what is the price for the product (Discounts, Promotions, ...)
Is it a good idea to have an additional explanation API for each complicated rule?
Example: boolean isProductVisible()
has an additional String explainIsProductVisible()
?
How to make understanding these rules easier?
Background:
Yesterday I as a software developer had the problem that my standard-testproduct on my local test system was "sold out" and I needed this product to test the order-confirmation page.
So I had to debug the IsProductAvailable
routine to correct the test data before I was able to do the original
task "test the order-confirmation page".
In order to find out, why my test product was sold out an explanation message would have been helpful.
In a similar situation in the price calculation engine I already added log messages like this
double calculateItemPriceForProduct(Product product, int quantity, Cart cart, ...)
{
double cumulatedPrice = 0;
...
if (quantity > 1) {
Price price = getScalePrice(product, quantity);
if (price != null) {
cumulatedPrice = price.getValue();
if (log.isDebugEnabled()) {
log.debug("calculateItemPriceForProduct("+
product.getCode()+
") using scalePrice " +
price.getCode() + " for quantity " +
quantity + ":" + price.getValue());
}
}
}
...
}
As a developer I can look into the server log and hopefully find out what happened.
If I were a product manager it would be more comfortable to have role-specific tooltips on the webpage that shows the explanation part.
Of course these tooltips would not be available for ordinary customers, just for developers and product managers.
My questions:
- Are there other ways to make understanding complicated rules easier?
- Is it a good idea to have an additional explanation API for each complicated rule?
- Does such a feature pay off the cost of developing this feature?