Skip to content

Comment on My favourite interview questionparent

Comments

Take any problem where there are rules and n exceptions to those rules. All salesmen get cost * x% commission on an item EXCEPT when it's a a) our annual year end sale then they get y% or b) when it's an internet sale then they get z%.

That's the pattern to all this, rules and exceptions and how easy it is to change those rules (because they change constantly).

So do you put all that into your SalesPerson object or is there a better way to abstract the logic of commissions?

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.