I was asked this in an interview where the interviewer after talking about basic stock and inventory classes stopped me and wanted to talk to me about triggers . He gave me this scenario .
He said that suppose you are on a stock brokerage system where you are allowed to make decisions in programmatic manner . for example
- Sell all Microsoft stocks as soon as average of Microsoft and Facebook stock comes bellow 100
- Buy 10 Google stocks as soon as microsoft stock rises above 161 dollar
How user enters this info in UI is immaterial . Assume you know rule and the list stocks symbols on a rule give to you in a vector . 1 user will have just 1 rule .
He said that such a system would need to be extremely fast . As soon as a stock changes all programmatic rules are executed . How will you design this triggering system given that a stock brokerage system will have 1 milion active users .