dimanche 23 mai 2021

Toaster system design

I am studying system design questions for interviews. I am so new to this type of question. I have a question and want you to help me better understand this kind of question and how should I approach it.

Sample question: Design a toaster.

My ideas:

  • Toaster can have multiple racks/slots (1,2,3,4)

  • There will be ToastType. I thought it will be enum { Bagel, bread, muffin}

  • There will be shade level. This can have different values based on the Toaster model. Mainly it is int field can have value 1 to 7.

  • Also there can be "defrost", "reheat" and "cancel" options. Those can be also varied based on Toaster Model

  • Toaster will have the "Toast" method

  • ToasterManager class will get a toaster with specific config and items and call the "Toast" method.

  • I can use a factory design pattern for the Toaster to create a clean, extendible solution. New Toasters can easily be added.

I can't put those ideas into classes. I am also confused that this problem should be solved using a state design pattern or a simple OOP implementation type of question. I feel that I am lost between ideas. Can you help me to clarify and show me how should approach those problems?

Thanks

Aucun commentaire:

Enregistrer un commentaire