Microsoft Interview Question
SDE-2sTeam: Windows Azure Mobile
Country: United States
Interview Type: In-Person
Thanks for the detailed answer.
Here are some differences in how I answered it -
1. First, I outlined all requirements for the DM that came to mind. Starting from the most basic "Should be able to download a file" to others like -
- Should provide admin functionality to blacklist websites so other users can't download from those sites
- Built in virus scanner
- Ability to calculate expected time based on bandwidth and let the user know how long it would take.
and other basic requirements
2. Special features
- I should be able to provide multiple locations - multiple trusted devices and even online storage location like Skydrive, etc and downloading the file should save to each of these simultaneously if I've selected that option.
- Automated download/subscription. Say, my friend uploads pictures to his Instagram occasionally, I can subscribe to it and have the DM auto download whenever pics are available.
For fault tolerance -
Keep appending the bytes of the file to a temp file. Maintain a sourceFile->localTempFileName mapping in a DB. When machine restarts after crash, then check the size of the temp file and start from the byte number after the size. For instance, if the size was 546 bytes, start downloading the source from the 547th byte.
He was very happy with my ideas but unfortunately my component design was actually rough. They had many candidates applying for the position. I was told that my skills didn't match their requirements.
Great question :-
- hprem991 February 24, 2014In My opinion I would like to Put this as :-
1> It should basically work as an Independent module which can be integrated as the plugging for various application.
2> For that, I would like to expose an interface say DownloadURL(String URL).
3> I would also expose another API for File Storage Like SaveFile(String filepath).
4> Internally , I would implement these API by breaking into Modules like. File support and fault tolerance .
5> For File fault tolerance, I would basically implement a counter for bytes downloaded to the bytes to be download. I would Cache these bytes till A > User Cleans it , B > Files it 100% downloaded and 3 > System Cache Overflows .
6> Actually it a Huge Application so we can go a long while ..
Now Second Part Follow ups
1> Feature like stop and resume download is mandatory .
2> Another One could be data rate control. Like User should Be able to allocate the bandwidth for each of the specific download during parallel downloads etc.