This is one of the questions that I came across while preparing for a programming interview.
Design a system for Greek philosophers to exchange messages using stone tablets carried by dumb slaves.
Well, the guys who had this question have suggested to use analogy of a TCP/IP protocol to describe the communication and some suggested packet data communication to explain the design.
Here is what I think of it going by the clues:
- The Greek philosophers would act as 'machines' that are trying to communicate.
- The dumb slaves would be the message carrier which is the 'network' in our analogy.
- Stone tablets would be messages carried like the 'data packets'.
- May be the slaves would reach philosophers by asking for the route from some random guys that will lead them to the philosopher's place just like the packets arrive at a destination using routers in the network.
- And the message could be split in to multiple tablets and so, a message could be eventually carried by more than one slave who might take different paths and arrive in any order. There shall be a way to arrange the message in the correct order on their arrival at the receiver's end. (sequence number in the tablets?)
- The system should also be able to handle missing tablets and in which case should the sender philosopher try and send the entire message again after a timeout?
I would like to ask the following questions:
- Am I thinking on the correct lines?
- Are there any important things that I am missing in the things that I have listed above?
- This question to design a system looks vague to me. How would someone depict such a system in an interview ? Using diagrams to show interactions between entities?
- Am I handling the missing tablets issue correctly (Mentioned as point 6. above)?