Pregunta de entrevista de MyHeritage

Tell about former projects and technologies you used. Design a Logger module.

Respuestas de entrevistas

Anónimo

19 feb 2018

Classic chain of responsibility design pattern, but i guess they had something else in mind.

Anónimo

24 jun 2020

It's not a chain of responsibility pattern at all To understand which pattern is fit the best I think we should understand what we are expected: - To create a Logger which will get all the logger events - In case there are multiple loggers (Facebook logs, server logs, etc.. ) you expected to send the event to one the Logger instance and he should send the event to all the loggers. - It's better to set each logger into only one class implementation, so in case something needed to be change in this logger you know where you should go to. ( e.g you should change the token id of facebook logger so there is only one class that should import FacebookAnalytics so you don't need to waist time on searching the class) The solution is Composition design pattern: The implementation should be as follow: 1. create one interface to manage the events: Interface EventLogger{ fund sendEvent(params: [String]) } 2. all loggers should implement that interface 3. Create LoggerManages composition singleton that save list of EventLogger 4. The LoggerManages should also implement EventLogger interface the implementation of sendEvent(_) is to logo of all of the list of EventLogger and call their sendEvent(_) method