all right eugene so tell me about yourself yeah so hi uh my name is dj messock i have been android developer since 12 20 uh i worked at different companies like zburbank and kaspersky last five years i work at kaspersky where i took titles like a software expert and software architect so when i was a software expert i was responsible for command patterns and architectural different architectural design principles and all this stuff for mobile team that contain more than uh 15 50 developers and when i was a software architecture i was responsible for uh testing infrastructure yeah uh that was used by more than 1 000 developers also i'm author of a lot of different articles uh talks and all the stuff devoted to different topics like architecture analytics rich java and uh the last thing that i'm a founder of caspareso library it's a library to for after tests uh in android so yeah awesome sounds good um so without further ado let's just jump to the question so our question today is um design a photo application more like google photos and uh what we're looking for we're looking for to support a wide range of audiences uh not limited to uh like western countries united states but basically worldwide we also want to include sharing and we need to support albums right so we can create different albums you can put photos there and uh privacy is also really important for us okay got it so uh do you see my screen yep uh so great uh so requirements requirements so yeah i just uh remember uh so no uh privacy or security you said yeah i just understand i said privacy and security is really important that's probably the number one requirement uh important yeah yes okay privacy uh security uh important okay next uh so we are going to uh what features we are going to have it's i just remember album what else album sharing album sharing okay so photo applications uh it means that we can take photo edit uh it yeah and so we can take photo and edit it uh i'm right i don't think we should edit it so let's leave the other scope yeah okay take photo but editing out of scope uh so i you said something about limitations yeah i missed it uh about limitations i mean uh the number of for users and all the stuff so what kind of uh yeah how much users we will have and what plans for our product in there let's imagine that we're gonna have one billion users worldwide one below one billion users is especially popular in india app is in india yeah popular okay so we will have some problems with network and all this stuff aha okay price album take 41 billion up is in this so uh what uh what we are going to consider it's a client client plus ipi or client plus ipa and plus back end let's just stick to client and maybe discuss um apis if we have time okay client plus iplay so what else what's important privacy security photo okay so uh also it's offline mode sure because we want to uh have a chance to see our photos okay so offline that's why it will affect uh possible storage with all this stuff a what else yeah vip app so it's a standalone application standalone application so okay uh if i missed something please uh please fix me uh but i think that i uh showed everything that you said am i right it's it's incredible sure so uh functional so functional and non-functional requirements uh uh first of all it's uh uh take photo next it's uh album uh sharing album sharing yeah it's enough uh and non-functional requirements will contain a eee so network uh network concerns because we will work in india also of offline with all this stuff storage and so on uh privacy and security yeah privacy and security so privacy and security i think uh we just also think about authentication and all this stuff yeah we'll think about it uh authentication right now so imagine like magically the user got authenticated so we don't need like login uh sign up flow we can do it ourselves got it so okay it's our main uh requirements yeah functional non-functional so uh let me to start with a high level diagram i think yeah so it's good okay so first of all uh what we have so first of all i just uh let's draw a main features first of all it's a take a photo uh model yeah another thing it's uh uh album yeah album so elbow model so not album model but i think uh photo watching yeah watching model yeah and it will contain a uh all photos all photos and albums yes so it will contain both of them okay and sorry uh what do you mean by module uh so model i mean um so first of all it's like a separate feature and model i mean maybe in the future it will be a separate model so if we are going to create a very very uh good application here where our user uh uh our users one bill where we have one billion users uh that's why uh i think that we will have very big theme for all this stuff and that's why i think it's better to think about model separation yeah to improve for work of big team so that's why uh first of all i think that's uh first of all it's a logic model and the second maybe it will be separate gradle model yeah okay so but uh separate gradle model it means that maybe it will uh contain uh another model so it's it's more about logic now but we will see a little bit later okay okay and next it's a sharing sharing model but sharing model sharing model i think maybe it will uh maybe it will we will join it in the sharing model to photo watching model but we will think so from the scratch we just make it separate but maybe later i will change it okay we have our business features and uh what next also about our non functional all this stuff so uh sure we have some kind of back end yeah and we will have some kind of storage yeah we will have some kind of storage uh so yeah i just uh didn't clarify very important thing so we have a photo application that's why uh we can we can upload and download photos am i right yep yeah upload download photo sorry it's very important and i just want to uh add it to our functional requirement uh so we will work with upload and download our photos that's why we will have a storage um storage for uh storing our photos i'm not sure about database something else we will cons we can concentrate it a little bit later when we will consider a concrete flow also we just need to have some special model that is responsible for uh encrypting decrypting model so why it's important because if we want to have to support some kind of privacy and security uh we want to reach the state when other developed other users can read our photos and uh that's why this model will be responsible for encrypted encrypting and uh by what k and suffer girls consider it later so what does important offline uh offline mode offline mode uh okay with this this and also yeah uh we will uh we will draw some kind of uh di yeah and some kind of uh navigator or coordinator yeah that will navigate navigator or coordinator that will be responsible for yeah i got a quick quick question the question yeah yeah yeah i was not sure like what exactly navigator or coordinator does uh so can you explain uh repeat please i didn't understand second uh what did you say about navigator coordinator i didn't understand yeah maybe i interrupted you too early but uh like immediately i was not sure why exactly you need this company and what would be doing a navigator or coordinator uh so this component will be responsible for uh navigations uh between different uh between different screens yeah anyway we will have uh screen for take photo for watching all photos watching albums watching uh concrete photo uh for sharing here and we just need we will be forced to navigate within this uh squeeze and this uh component uh will help us and we'll uh will maybe provide a basic different components like a router router uh navigation holder uh navigator yet to try to separate uh try to try to separate implementation of navigation uh and uh using a navigation in our screens so something else right uh so it's our high level diagram [Music] upload yeah and the last thing that we just need to upload and uh download uh photos upload and download photos so maybe we will have a uh yeah i think if we yeah i think we just need to create a separate uh upload maybe don't load photos so maybe we will uh need to create a separate model that will uh upload to download photos because we will have a very weak uh very weak network and that's why our network can be disrupted in something and interrupted and all this stuff and this model will be responsible to save uh progress and to serve progress and so on and continue uploading or downloading so yeah i think it's it's all that i wanted to uh mention and maybe we can consider some flaws that maybe you are interested more yeah so what i would really like to know more it's about albums because uh like briefly we mentioned them in photo watching module but i really want to know how we download them stores them and present them okay got it uh so let's think about feature albums yeah how we can organize it um so i think that albums uh what does it mean let's maybe uh begin with a uh descriptions of this term here so first of all it will have some kind of id will have some kind of name some kind of description yeah and what's important it will uh contain some kind of uh list of uh photo id yeah not all photo uh but list of photo id and i just remembered uh one very important thing because we work in india our network is not very good it's very important to support some kind of some nail photos here so uh photos with different resolutions here to give us a possibility to download maybe 14 uh was or better quality yeah just i also added this and here list of photos id so it's our almost what about what about what what is it here so photo first of all it's id maybe also some kind of description yeah and uh first of all it will be uh so it can be or broad raw bytes or maybe a reference to storage so now it's uh doesn't matter we will consider it in details and what does it mean albums yeah so we just uh for example first of all we have some kind of screen of photos yeah photos it will be a a list of photos yeah and we can photos yeah for example these yeah these and so on and when we click on the photo yeah or we can see a photo or maybe a some kind of context menu where we can add to concrete album yeah i would say we don't need to go into ui i'm i'm not interested in you guys as much yeah yeah so i'm just trying to understand storage better so the first question when you mention like uh raw bytes with reference to storage uh which one would you pick interesting so uh yeah okay so i just wanted to clarify that albums here will uh contain uh first of all this uh thing so that's why when we just uh open an album uh we can download photos using this field okay is it okay yeah uh so i'm just trying to understand uh the storage so like yeah yeah yeah imagine you have tables right so like no matter if you working with some rm provider they usually like by sql light could be yeah like not the case but imagine that's the case because i i know which library you might be using and um okay so would you store raw bites basically certain blobs or would you store a pasta file and uh yeah got it what is it yeah i've got that alex i just wanted to complete to close uh our previous question so i got your question about robots or after storage what to do in our photo uh so what what's what's better but so yeah really we have two options here it's uh block into a database or just just files yeah and just uh files so there are different opinions how to make it better but also we just need to think about encryption and decryption yeah and uh encryption and decryption so we our photos will so we will uh store a lot of photos a lot of photos maybe a lot a lot of photos that's why uh storing it in database our database uh can be catch some kind of out of memory and suffocate because uh just imagine 1000 of photos into database now it will not work so that's why our that's why our choice is to store it into files yeah so and what does it mean files it's uh raw bytes yeah but it will not be just simple robots it will be encrypted yeah encrypted bytes yeah it will be encrypted robots and i can uh show you uh the flow how it will work okay so basically maybe i'm not quite following but so which one did you decide did you say on blog or you decided files files okay yeah because blob in database uh so we can uh store a lot of a lot of files and it's really not it's it's not very applied for databases so and i can uh show you the flow how we can uh store uh with encrypting and decrypting your or just what do you prefer um i'm not sure if i follow me so like when you you mentioned flow what exactly do you mean uh so i mean that for example uh the flow how we can uh so when we open our application yeah uh and we want to see a list of photos yeah so how we can uh how we will download these photos yeah using what models and all this stuff right yeah and that's it yeah okay so for example we're here yeah and uh what for example yeah it's our like photo watching yeah just photo watching photo watching model yeah and we just uh want to download photos so i suggest to use a pattern repository yeah that will uh hide a that will hide uh in details of implementation how we are going to get uh this data so next we uh go to so we will have some kind of storage here we'll have some kind of storage and we will have a special model like encryptor yeah and decrypter so that's why uh we can go here to get some kind of maybe uh yeah we we can first of all uh go to the uh storage download photos and next yeah use encrypted decrypter to uh decrypt our our bytes and uh return to our now module already files yeah so it will be first of all we go here which component would be responsible for downloading for us for downloading uh photos yeah would it be repository or would it be something else and what's the purpose of repository why did you use a repository pattern here uh so yeah i just wanted to mention that here we are consider offline mode when we have uh downloaded photo downloaded photo in our storage yeah so and i yeah downloaded photo and here yeah the scenario is simple but what about when we have uh online uh you mean when we yeah you mean this here when we are online and when we don't uh when we didn't download photo before and uh wants to download it's from cloud save to storage and all this stuff or just we consider only of uh uh situation when we download it early photo to uh you cover them all right what like we're not looking at one case if it's like online or offline we need to make sure that it works in any case got it got it your idea okay we just want to consider all of this stuff okay let's think how would to uh how we just need to organize all this stuff uh so yeah okay just remove for temporary all this stuff [Music] yeah so here our picture will change yeah because uh yeah you got got your idea got your idea so photo watching model i can can want to download a lot of photos yeah a lot of photos uh a lot of photos yeah and what we are going to do uh so a lot of different photos uh that's why i think it's better to use a special model like uh these yeah uh upload or download photos model yeah uh what what is it i think that here we can use ah [Music] so what i'm looking for so imagine we're applying repository button right yeah so when he said upload download photos um like i'm not sure about how the data flows so imagine like you have photo watching module like when you can display all albums maybe some something yeah yeah yeah then you ask your repository for some data so yeah what would repository do and which scenarios uh would you need to cover yeah yeah got uh so we can consider repository as a pattern that hides in implementation here how we are going uh to uh to obtain these photos yeah so uh how to obtain these photos and that's why um we can so and that's why here i think that we can use as some kind of maybe secures pattern so what does that mean uh i think that we need to separate all our uh tasks yeah or something else into two things it's a comments yeah and just queries so what i mean what i mean comments are comments i mean such thing like a like a uh don't maybe yeah download photo download photo and some kind of id yeah so we just uh asked to download photo yeah and uh in queries i mean that we have some kind of maybe channel where we uh it's a special observer that will return our results that will return different results for example we downloaded uh we downloaded photo 10 and next photo for and next uh photo uh six and south africa's because we are going to download uh maybe a lot of photos and something else and we cannot uh and uh i think it's better to listen results in one separate channel not in a lot of yet uh a lot of channels and such requests in one channel and uh let me interrupt you just for a bit uh so um i miss this part when you introduce tasks so what are those what exactly are tasks and um like why do you need commands and curious and what is channel so there's lots of questions so let's start from the top yeah why do you need tasks so why i need task ah tasks i need uh so the the the first uh so let's uh let's assume yeah let's assume that our repository our repository uh can have a very simple uh i can have a very simple design yeah like just get photo get photo id yeah and for example it's uh some kind of uh it maybe it's a blocking maybe it's returns as some kind of maybe it's yeah for example it's a blocking yeah oh it's uh i think so it doesn't matter yeah and uh let's imagine that a photo watching model calls a 10 or 20 uh 10 or 20 or 30 maybe more uh times this method almost simultaneously so uh yeah and we just need to handle this big number of requests yeah this big number of requests and uh this number of requests yeah and we have some restrictions on our network yeah because we work in india we have some problems with network and we cannot open uh 30 uh parallel connections to our network that's why we just need to decrease uh to limit the number of connections here and to create some kind of queen yep and when we work with some kind of query or something else it's better to operate with such terms like tasks yes or task to do this task to do this yeah and further uh for me it's better when we separate yeah these two things for example a separate comment then we just want to download photo yeah and separate a query yeah it's a channel where we listen results yeah and we don't await these 30 open connections especially we have one special channel where we uh obtain results yeah and for example we uh downloaded photo this year okay just show it and so on so yeah okay so let me try to make sure that i understand so basically you have selected a synchronous api for your repository and repository would both uh be able to upload and download photos right so it's like bi-directional communication uh what are you trying to do you're trying to add like um some kind of queue like a dispatch queue when you would like to limit the number of concurrent operations uh is that correct yeah so you yeah you just uh state everything right so we will i think that we will have some kind of dispatcher yeah that will responsible for uh some kind of queue yeah some kind of cure and i think that maybe uh yeah i yeah uh some kind of queue and the dispatcher will be responsible for q and we'll apply some policies for size of cues and all this stuff and the the example of so it will be some kind of job yeah and the example of job will be just for example download download yeah maybe upload upload uh and something else um yeah um good question what's the difference between a task and a job so we try okay that uh the difference is that we try to to to make separate these two terms so task i suggest to use uh so the task terms i suggest to use for our api so i mean that for example here we can do we can use a download for example download photo id it will be comment yeah uh it will return for example nothing or maybe just that status or maybe status okay and it will uh create a task yeah but uh in our dispatcher i think that it's better to transform tasks into jobs because uh dispatcher yeah dispatcher can be can be dependent on different for example policies yeah or something else and it's uh policies and something else also we can have some kind of different maybe sinkers or thinkers that will responsible for to clean our storage yeah and some some moments and that's why it's better to have a separate uh entity for all this stuff so just separate tasks and jobs or tasks we use more for our uh api yeah that we provides to our users like a photo watching model yeah and jobs it's our uh uh details of implementation that we use in our dispatch and our queue yeah okay so basically uh a task represents like your intention right and job is actually how are you going to do that so my obvious question like why can we just like merge them so imagine you create task as an interface right and then put it down and concrete implementation can do that so i'm not sure like why exactly this design needs to task in the job so so i can maybe i can answer in your question because uh further uh the number uh the number of tasks will increase the number of possible jobs will uh increase and uh maybe for dispatcher will be responsible some another team for repetitory other team and it's better to make it uh separately because it it's it's more about the future yet because uh it's better to use for for each level it's better to use their own entities or models yeah because uh they will change they will transform they will differ from each other yeah that's why better to separate them and don't think and don't uh struggle with all this stuff in the future that's that's my point that's my okay okay uh let's talk more about like uh sync and policies uh so for the policies um how would you limit the size of the queue so how many jobs how do you decide the number of concurrent jobs you can perform yeah good very good question very good question so uh i think that first of all we just can introduce such things like so network yeah network model i think uh i i think it's about quality it's about quality it's about type so it's a network model i uh it's mean i mean about a state of network yeah uh network um maybe some kind of uh yeah and and for example network quality type another thing maybe like a region region specific what i mean that for example network cost network cost uh maybe something else so for example yeah i i wanted to include networks into network state but network state is more about this more about the state of the device here and network courses is a external thing so region specific uh maybe something else yeah and all this stuff will uh affect uh policies um what i mean so uh policies will affect policies so it uh the first version can contain uh entire logic into policy so we just know some interfaces from networks some interfaces from region specific and we will push all this code into policies yeah but further i think it's better to to give a business possibilities to implement different experiments and that's why uh this policies will be work very actively with such things like be a the experiments yeah and maybe further we can uh transform policies in so in policies model we can use maybe some kind of uh back and driving development approach yeah where we can change this logic uh in runtime without uploading new version because it's very very important thing that will affect our in our our business yeah and it's better to consider a lot of things and be able to change it very quickly and experiment very quickly okay uh that does make sense so a question uh like when we push in a b experiment flux right uh how often would you push them and how would you handle situation imagine that you have a customer in indian village who has a network connection for 2g every 6 months so how would you handle this so how how to deliver experiments or uh when we don't have uh a good network yeah um yeah it's basically like two questions the first one like how would you build uh experiment experiment delivery so i mean like how often clients would receive it and second one how would you handle cases when uh like a client installs up and then goes offline indefinitely uh yeah interesting okay uh so first question here what uh what we can use so we work in india not in china uh so for example except china and that's why we can use uh such things like a firebase cloud message or google uh yeah for android it's more about firebase cloud messaging that supports all this stuff i bare experiments uh supports analytics and a lot of a lot of things and allows to create some kind of the entire pictures for example we have these experiments it affects our data in this manner and in this manner and so it's very very uh cool thing uh alternatives of firebase cloud messages honestly i don't know good alternative uh that that you know it doesn't matter it doesn't matter yeah okay so and what uh what to do with offline mode yeah it's very good question so here we uh we have no chance to deliver something new for our uh user so that's why so we don't options here and that's why anyway policies must contain some kind of uh logic yeah uh that is uh independent that is uh that supports a network uh that network is uh doesn't exist here yeah so we so in flight we don't have any options we just need to be have a policies yeah and this policies must consider situations when we have don't have network yeah all right so we are almost in a 45 minutes mark and usually not gonna have that much so let me jump straight to the feedback so i'm gonna share the document which i um used so maybe it's better so i think that i can stop sharing and i just uh share actually you can you can keep it so everyone who wants to watch uh they can open the door and just see it and like they can see my cursor my selection because it's really good to keep your uh uh drawing so we can address that yeah yeah i i just uh thought that i can share a link to this excel draw yeah i'm sure yeah that makes sense but remember like uh it's not gonna be saved and it turns that if you try to open this link in a couple of uh days it might be go it might go away so if you want you can export it save in some way make a screenshot just to make sure that you preserve it if you want to use it in the future um so yeah i shared uh the link so guys just you can see it's separately uh so i will try to not delete this design but feel free anyway you just you are free to copy past so let's see [Music] intro was quick what i would avoid saying don't say that you're software expert or software architect why because outside of companies especially if it's not like kaspersky is a big company but not like funk scale and those titles they do not transfer very well and when you said i'm a software architect you're kind of bragging and it's like oh this guy's software attacks so we're gonna really grill him just to see like how good he is so it's good that you say i've been working on android since like whatever date uh currently i'm working on this i work on test infrastructure i build a library and i manage a team of people right so it doesn't matter we say it's not going to be a part of as a feedback it's most likely can affect like how the interview might approach you so i would say be as like uh humble as possible and just don't because like oh you're an architect and i'm like okay so let's go deeper um so yeah two minutes one two minutes is perfect it's more like an ice breaker it doesn't really so don't tell about your full history like the interview won't even listen to that so they asked this question more like just to be polite uh so system requirements so we had four minutes here which is about right so can you can you zoom a bit on system requirements um okay so basically like what was missing like i said okay we really care about albums and you never really asked like what exactly is an album uh so yeah so this is gonna like slip away and like okay so we'll see how it go um don't try to invent extra requirements like oh we need to edit the photos so editing the photo is just like separate design topic you can go really deep so don't dig your own grade because and interviews are like oh yeah cool like editing photo could be cool and then i would say it's it's a much harder task because not that many people actually built photo editors um so asking about the scope is a good touch uh he said um like uh back-end front-end most likely it's going to be client might be a bit of api but who knows maybe they said okay i really want to talk about back entrance and just say um i don't have much experience like building something a huge scale because remember we're talking about one billion users so it's not like as straightforward when you're just building like a test server just for yourself uh yeah mentioning offline mode and side effects you can produce is definitely a plus uh then i said okay user can take photos like why just limited taking photo why can we just upload them from storage or get them in any other way maybe export them from other applications right so why not uh when you said so we're building standalone app um i'm i was not sure like what exactly you tried to say this you said it's standard standalone but you did not really uh like piggyback on that so you said something and basically it led to nelson and like okay this is confusing um i would avoid repeating requirements so we discussed everything and then you would go and just like firstly put like this list which kind of contains everything and you try to break it down to different lists it doesn't help so if you want to your start like right away so functional non-functional requirements in autoscope and put it this way or just just leave the first least intact and just move forward because you're not providing you're not saying anything you but just taking your own time um so when we say um is that like privacy yes sorry alex i just interrupted you so how to uh how to better to highlight functional function yeah you've straightforward in requirements just for example okay it's a functional requirement on how it's related to the way i address this in my own experience i would just start typing func non-fund out of scope and when you talk it just like puts the points and everything just jumps so this way you only say it once but make sure that you like you write it down because the interviewer might just forget and the call is not being recorded i mean like not in this case but um january due to privacy issues etc uh okay got it like the way how you do it it's not really important like you do it like the way you feel necessary but you need to make sure that this is very efficient in terms of time and it provides lots of material which will go into the carbon packet and help make a decision i'm talking about flank experience i'm not sure how it works in smaller companies so we're mostly talking about big tech um okay so like i explicitly stated that privacy is really important for us but we didn't really uh talk about it so basically we jump like okay we're gonna store this we're gonna download upload so what i would really discuss is like are we gonna store every single client to a server so if privacy is very important we better not store anything on the backup right we better do any kind of peer-to-peer communications so we did not discuss it so what you can say like we can do client or site server side but now we're going to be using server side for example just just to simplify the design or something like that so you need to pick something but like if you don't picking something you just like oh i'm going to be using this and uh as the interviewer said like why why would you do this like no pros and cons just this is like a stated fact you cannot really tell your justifications um so once again i stress that so the app is really popular in india and we never really touch this part because like if it happens in a country with a very slow and expensive internet we might need to want to think about any kind of peer-to-peer communication so imagine like you took a photo and you want to share it so why can't you just go and share it with bluetooth with somebody else why can you export it to your external storage card why can you just drop it to your laptop or something like this because like like the internet might not solve all your problems because you may not have internet for many many months right you can only have like power supply and uh user settings as well so if you have environments very constrained so it's really good to give a user a choice to configure it's the way they feel necessary of course you can advocate for ml uh models etc but it's really hard to do right because like people who build those ups they don't build them in india like or if the indians they have very good connection very good phones etc so a ml solution would be uh like tough to pull off especially if you don't have any experience so i would say provide as many user settings as they can so how many photos can you download so would you download photos at all would you just like render the name of the photo and you said thumbnails yeah something else is fine but once again traffic could be really really expensive and respite and if you have like an expensive traffic you might want to say i need to add the support on my back end for for a download which i can't resume like you can mention http ranges for example because imagine you have one megabyte photo you tried and loaded it fails you try another one fails so at the end of the day the user would not have a photo and uh it like they just wasted a bunch of traffic and this is like what another stuff we never discussed cancellation so maybe when a photo is being downloaded you should add the button like cancel and show how much traffic exactly you've been using or like you're about to download this photo it's gonna be that much do you want to proceed so this is like more from the business point of view so remember system design especially when you put yourself as a software expert and i can't stress enough that means that you might not be constrained and you like experience candidate you might also want to think about business side of things as well all right so then we go to a high level diagram so basically you jump with this module concept and it was very confusing like what exactly a module is it like uh gradle module if you're talking about uh uh ios is it like a package like what exactly it is so i would prefer names and companies because one companies can be separate in many different modules so we said like our app gonna have one billion users so that means that we're gonna have lots of developers that might not necessarily be true you can have lots of developers and the up would never launch or like some guy in garage builds it and it just becomes instant success so i would not put like strong relation between this and i would not go directly into gradle because chances are uh the company would not even use gradle because gradle doesn't scale well as the project size grows right so it could be bazel blaze buck you name it and you might never even heard of it so don't try to constrain yourself into gradle because your interviewer might not might heard of gradle but have no idea what exactly it is what's gradle module is etc because remember people might have like very tunnel version vision for the experience okay let's move on um like avoid drawing arrows like like if you draw arrows you do them all you don't do at all because like drawing arrows takes time and doesn't really provide any signal so you can just try to group them together so for example in your diagram you put cloud and a storage like close and it's like is it the cloud storage is local storage well you understand that it could be uh a local storage but imagine then you uh like screenshot it submitted to hiring comedians that like they don't know the context of what exactly it is um okay uh encryption decryption like i know it's important but i say privacy is not all about encryption decryption and i would safely bake it into the storage module and avoid um drawing and just like some interesting stuff where she tried to practice myself as an interviewer like you said navigation coordinator and before you even have a chance to explain what it is i interrupted you it's like what the hell is this right so imagine you showed me some concept which is foreign for me and i just like oh this is not the way i understand it and i got like outrageous and like why the hell he put it there and i kind of feel like you lost it for a second uh like it's like i'm attacking you and you and you're just like oh okay i probably uh did something wrong it's not necessarily means that you did something wrong things that like the interview is confused and wants to have like more information right away or like you got them excited and just like okay so this is exactly but unfortunately you could not really explain why coordinator component was uh required like or navigator whatever you call it um so basically the idea like which you like the way i felt it you tried to sell yes uh it's will help decouples the companies so it's not about navigation graph it's like your goal is just to make sure that photo watching module doesn't know about take photo module or sharing module right so they would communicate using some kind of intents i'm not talking about android intents i'm talking about platform platform agnostic or use case or interactors like any way you you name it but basically you get some input and you tell them what exactly you want to do so what it gives you can build and test those things in isolation like you can launch them as standalone apps etc it gives a lot lots of lots of flexibility so this is like why you would want to have it if you just describe a navigation graph i would say it doesn't provide lots of information lots of signal especially on a high level diagram yeah so that takes eight minutes um which is about right you can take 10 but i i don't think there is a clear cut and then we jump to uh string and so okay so we talk about albums so first thing what happened uh you job right away so this is what we're going to be doing uh it would be really good to actually explain the decision right so for example we're going to be have like one uh entity one table which would uh like can you scroll down just so you can see uh where is it yeah albums so id name uh description list the four ids right so for example why can we do we just store albums separately and we store all the photos separately and each photo knows about album id like why can't we do that and just make a simple join um to present the data so like i know that this is really inspired by room for android how you would do things but under the hood it works with sqlite and uh like imagine your interviewer never used room that might be the case most likely they build their own ramps and um you i want to explain a bit more on set like okay so i'm going to be using an oram and this is how it's going to be stored but under the hood you can store in this format and in that format and just try to explain yourself a bit more um so it's very important to pick a concrete solution so we said okay we're going to be storing photo we're going to store rough bytes robots or reference to external storage and you said that this is not important it is important because this pretty much dictates how the rest of design goes so what he was saying i said that we will consider it later i i say that it's not important right now but we for some reason it arranged me a lot in the menu like imagine i'm an interviewer and i'm writing feedback and uh so i would make no assumptions and i would try to pick something because imagine you're a software architect which cannot decide what to use like you should pick something and explain what good stuff gonna happen like what like advantages with the approach what can go wrong disadvantages and um so for example we started uh like i tried to uh like dive deeper and you try to dodge the question right you start talking about unrelated things you try to bring your eye and constantly try to move you back but you kept kept like being indecisive so what might happen you might not really know the answer right away and you would need to have your some time to think so it's totally fine said okay let me see and started talking a lot so what can uh like what can go wrong looking right etc and um yeah when we try to explain the reasoning for not using blobs like uh blobs can be really really really big and you're not going to run out of memory because you're not going to load your whole database unless you reduce it so usually you use some kind of cursors or whatever which only read data as you need it and we discard it so i would say the reason for blobs for not storing blobs is not valid and honestly i can't really tell like it is going to be good storing files or blobs people say oh don't store blobs in database but they don't really explain why and it seems like it's a well known truth it's like axiom so you don't need to prove like oh we don't study blocks because it's bad like if you make statements like that you better be able to explain why exactly i personally can explain i so many different opinions like what it would store i would like if i would use it i would probably use a file why because like i would keep database lightweight like only store metadata and store actual data uh on a disk like actual blobs and disk i'm not sure if it's the right way it was the correct way but i would say this is the way i would do that but there are lots of different opinions of what you can stay like is it blob versus file storage but i have no idea how to explain it so i would put it this way um so then we quickly jump in the concept of flow so the concept level was not clear and uh i was not sure why i would try to draw the flow so you got me excited so i didn't really want to know about the flow but i said hey i'm going to draw the flow how data goes and you got me excited so even if it was not a part of interview i really want to see like where you're gonna go with this and the way you ended up with the repository was kind of disappointing because like you got expectation high and then delivered low this was just my impression maybe people who watch has have a different opinion i would like to to hear it and um like it seems like in the very beginning you're not really sure why exactly you need repository so the way i understand it might not be necessarily true that you try to obstruct different data sources from the rest of the app so your uh whatever photo watching module said hey i need a photo and you just ask repository and you don't care where it comes from like you just need a photo and that's it and then you can like when you test you can swap it you can like provide in memories uh in memory serving something like this which simplifies things a lot um yeah let's see well i would not try to oversimplify the case so we said okay so we might have what if we online only offline only you don't want to do that you want to build a robust solution like something which would work in any case no matter your internet uh connectivity like something which you catch um you keep saying lots of photos but you never show this as a design so i'm gonna have lots of photos lots of photos but yeah that's that might be obvious but how exactly we're going to show this in the in the design um it was a case when i kept asking the same question and the reason for that because like when the interviewer type when the interview is typing notes they might not be fully paying attention so that happened to me i'm like type in a long note and i totally missed what you say and then it repeats the question and uh you should remember it so it would might not necessarily mean that uh like that you said something wrong once they tried to force you into something so what you can say is get as i said before and you stated and okay so they're good with that and they keep keep going so remember it's not just about yourself the interview can might be distracted they might be checking their phone so you should be ready for that your goal is just to provide as much signal as possible um so then you brought the task command and query and this was like completely out of blue it's like blew my mind like okay it seems like we're talking about different stuff and um he said like common curious channel like the concept of channel was not a very uh not not worthy is it like kotlin channel what is it what is this so like that that was really hard to get out of you because you keep keep dodging this and let me say okay it could be async or sync but it's like like not important like as i said you should be very decisive you can say it could be async or sync and then you say exactly but from the point of view of the repository like having sinkholes might be a very poor idea because then higher level of the app should handle this and you should have some entity like repository say hey give me a photo and it should take make sure that you have exact number of like concrete operations et cetera i would hide it way i would hide this implementation away from the rest of the because the rest of that doesn't really care okay so basically when you talk about like jobs dispatchers uh make sure that you can express your thoughts clearly so i would need to go back and tell you exactly how i understood your possible design and basically like you said oh yeah yeah this is exactly what i meant so that that was a bit strange um so then we come to this uh job versus task that was not clear to be honest so the reason like i think you might want something like this is like tasks are basically just data objects they don't really do anything they only contain an intent you try to execute you try to invoke job on the other hand it's actually tied to a physical worker so tasks are numerous and cheap jobs are like it's very small amount of them right and they're very expensive so you can have hundreds of tasks queued but only like four jobs executing so this made this way it would make sense but from the explanation which i got it was very hard to build this and uh so when i said okay so how would you limit the size of the queue and basically that was a very straightforward question well you said okay we're gonna like monitoring the network state we're gonna have like region specific like network cost and then we're gonna bring a b experimentation so you you totally dodged the question right so what i would say based on device state for example if you on the server connection right if you own a battery and especially in india we really want to limit this so if a user wants to download something it's better to tap on the photo i said are you sure this is this is how much is going to cost you and bang you put it it downloaded but i i would not expect too many requests from a phone on an expensive connection which is very very spotty so basically what was missing from the design so the requirement that it's the most popular app in india was totally ignored and there are so many ways we can take it away from this it's like okay peer-to-peer communication like how we estimate uh data so for example you might provide the setting where the user types how much money they would pay for one megabyte of traffic so instead of showing kilobytes you show it in rupees which is like you know it's much more expressive because uh like people in uh rural areas they might not like the concept of kilobyte megabyte might be foreign for them or if we try to work with operators which would pull this data or read from sim card some but there's lots of lots of creativity which can go here so this that this design uh question is very very very popular and uh i i can keep asking it all the time and keep going in very different directions so you can't really prepare for this it really depends like what the interview you're going to be asking so this way you should not try to learn it by hard and then reproduce something you should try to actually solve the problem ahead and there is like lots of discussion like lots of like waiting pros and cons so yeah this is uh my feedback and uh with this in mind uh like if anyone has any questions or want to put any any feedback so please raise your hand there is a button and uh unreach yourself and speak yeah and i stop sharing here yeah okay hi all my name is so i'd like to start with the requirement part so i believe after i read uh while i are listening i felt like on the privacy part a bit back for me because to the point for example what we are mean by the price and secured to us i don't get like does it mean are we going to share this specific photo with him some specific friend or are we aiming to while sharing tweets or uploading the photo with our backend or with someone else are we going to somehow encrypt a decrypt or somehow are we going to change our case to encrypt or decode the files so i i feel like it would be better to make it a bit more uh cleaner because the privacy and security is a bit uh white term so it's good to mention but uh to point or go deep detail it would be better it's my first feeling and please interrupt me uh in case you disagree or any question what i mean and also uh while also listening about the repository part i'm a bit lost because i was think uh because i based on your city what you are telling i feel like you are also doing something to upload and download photos based on your description but i was also thinking don't we already upload document photos on your box and also the uh personally i wouldn't also go too deep about the dispatcher etc part because it's too close of time because when i checked my time around the 35 minutes you are still talking about that one but you didn't mention uh there are also lots of points that could be a more potential signal for you because in the five minutes in the remain fireman you need to address about where the store how to store how to actually solder uh conflicts in case for example what about network is not available what about if the user remove the photo etc there are lots of opportunities also to buy alter but i think we spent most of our time about uploading part so i think that on on the other part there are also lots of signal points and also on the encrypt decrypt part is also other point but because encrypted crypt is as a thought is okay but if you want to go more deep you need to also tell a bit about for example listening for based on our privacy setting listing the photos only will be invisible by the alex for example how are you going to ensure that are you going to share your look the keys or are you going to do something etc so only that part i think it would be better to clarify that one but i personally i wouldn't do that because it would also uh you you might end up gets lots of question for example you could uh yeah and on the other part i own the album parts for example we you mentioned about the list of photo ids yeah it sounds good but for example when i look at that when i was feeling like you were subscribing to your database design so it's also not traditional right putting to add my inside album so i i feel like it would be better to you can either create another table like the photo album or simpler one just put album id inside the photo it could be better and also on the robot center rev storage is also kind of tricky thing to you it will do better because especially on the mobile side it's a bit tricky because the privacy concern also the api level you need to also think on it at this dimension it would be better and also the last thing on the sync part is also another word like to there are lots of things we need to do like the how many files we are going to upload how we how we are going to do it like either creating a single channel update or on each thing to upload there are lots of things and especially like i think key point in india like the network is not stable and maybe expensive so we need to consider those points but the last final thing the time management i could say yep yep so basically like remember the systems that equation is designed to be vague so we said privacy is really important the candidate said okay it's like what exactly is privacy like what are we doing so yeah i totally agree this should be covered right different signal points that really depends on the interviewer so in my experience i got interviews which like really laser focused on some one thing and they want to go really really deep because it really depends on a is the experience level like what they're excited about and what kind of signal you're looking for so as an interview it's really hard to influence this so you should be ready to go as broad or as narrow as possible at least the photo say this is what i forgot to mention uh yeah like where is it coming from so what if you took a photo and it's not uploaded yet what's the photo id like what if you create an album so that's where we can mention the concept of local and server id like would you generate them on a client would you have like two versions like once you store them in database the second one is as to perform all kind of uh network communication so trello has a really good article about that i don't have a link right now but if you google something like trello local and server id you you will find it um sync part is another word yeah i totally agree it's like bank it's out of blue and there's lots of opportunity here so uh like we could discuss peer-to-peer communication imagine like you have relative in uh in in a rural area and they take lots of photos and you live in a big city so why can you just come and sing those devices so those photos from one device would be transferred to another securely and then when you gonna come online with a broad internet connection you would basically upload them on that user's behalf so the rest of the family can see so this is an interesting use case like we can duck there and once again yes like when you're thinking like what exactly gonna be thinking how much data how much disk storage space you're gonna be using and that time management is crucial for this reason you should be as like uh laser focused in your answer as possible so they ask you a question you just straightforward answer it so this way you can cover much more grounds and you're gonna be uh like talking a lot and then at some point the interview would need to stop you right here okay fine let's move on so that's that those are very good points hello uh so first of all thank you guys for this interview i have several questions but i don't think we have enough time so i will ask only one uh what do you think about little different approach to design app i mean to start clarifying requirements not from high level uh things but from screens for example and based on this information to start uh asking and uh saying opinion for of architecture app um that's a good question that really depends like uh like what signal you're trying to provide so if you start with screens that means that you mostly care about user experience right some people would want to start from the point of view storage so storage is a single source of truth and everything you do it comes to storage and the rest of the app simply reacts to this and um like when you design a system like you usually don't start with scripts you start with components so there is a c4 framework for architecture like diagrams or whatever it's called uh i believe it's called c4 model.com like you can google it so basically they provide you the following approach so you start with like like 30 thousand feet you so only major components it could be like okay this is back and this is client whatever and then you keep zooming and every level you zoom you provide more and more details so the lowest level of zoom is like classes like you can actually look at implementation details so i don't know if there is a clear cut how you can like do this it's depends on like your style on the interviewer style so it's not like set in stone so this is how we're going to be doing this but if you don't have any other approaches so like i have seen cases when system design review and people okay so this is going to be view controller this is going to be recycle view or ui collection view this is going to be my view model so no requirements no nothing just straight to the point like straight to some screens and this doesn't provide much signal well but it's same time it's not simple it really depends on the level of the candidate so if the candidate is lower level it might make more sense to ask actually ask them about like nvx architecture so how would they build ui i would say have you model etc so in our case the candidate is fairly similar so he's a software expert i can't stress this now um so yeah so instead of giving in the screen so remember when the candidate tried so you said okay so this is going to be a screen that's going to be but i said i don't care about it i don't care about screen we're going to have ux departments they're going to build it we're going to run ad experiments we record we care about business uh business layer of this so we might not even touch screen touchscreens at all so this is just my my opinion might not be necessarily true so use your best judgement during the interview but this is a good question okay thank you yeah everything i say you take it with a grain of was a grain of salt so coconut uh iron crisp quickest around to navigation navigation and coordinating the i boxes do it is kind of necessary on the high level design uh i'm not sure about that one probably not like the candidate wants to show it and like the signal which uh you might want to provide that hey i care about the eye i care about uh like any kind of coordination between because what he mentioned that well we might have a big team right so we when we have a big team we try to decouple everything make sure that people can work on different stuff without stepping in each other's toes so this is a signal i got like some people said like why the hell like there's absolutely nothing to do uh with high level diagram but as i said there is no uh well um like received or agreed approach the system designed to use so nobody knows how to do that so this is one way and i like i personally cannot see anything bad about it yes it takes time it might provide mixed signal but if you do something make sure that you explain yourself like why exactly you put it there because otherwise you leave it to to the interviewer to decide like what exactly meant eugene do you have any comments on your end try to redeem yourself or ah so anyway yeah i just uh now i think it's better to analyze for me yet to think about uh all that you said and maybe later yeah i will comment but currently uh no comments so what i would say it's very easy to be a spectator and give feedback like oh you definitely miss it here so uh like try um taking your genes place and uh deliver design in about for about like 20 to 50 people watching it's a very different position so like i'm not judging any of what eugene did today it's just practice right there is no job even if you make me cry today right there's going to be no job it so your performance doesn't matter much what matters like what you and the rest of the people including myself can learn from this experience yeah see so you said that it's it's even stressful to ask the question and the reason for that like the question might be considered to be dumb and other people like like you should totally knows it this is toxic this is not what you want to be if anyone asks a question and even if you think that this question is not like relevant you just explain it and make no assumptions about the level of the engineer you're dealing with so imagine a situation when your interviewer is way less experienced than you are and yeah you need to make sure that they still they should have a good experience because those are people who are gonna write your feedback so if you're gonna be arrogant and said like oh no you actually have no idea what you're talking about and this is how it is it might not uh increase your chances of getting an offer and um like one of the reasons when for example you just said oh uh you're gonna run out of memory if you lose a database which i did not agree but there is no point of me of educating the candidate because hey i'm not helping myself to evaluate the candidate uh like if if they fit for the job and i'm just wasting time so like imagine me being a jerk and said oh you suck like this is totally wrong right and like fast forward we switch places and i come to the interview engine oh long time no see and now it's not going to be a good experience yeah so i can see can imagine how to interview spectators the whole idea is just to create as much stress as possible so this is why like when eugene made some mistakes sometimes i went a little harsh uh because like you should get used to the stress if we're gonna have like we got like i don't know what was the highest like 25 people i don't know i didn't count so if you can keep your calm in front of 25 people watching when you go 101 on the actual interview it's not that bad just a single person so the whole idea expose yourself to the stress it's like imagine you're trying to get ready to run a marathon but you just do labs around your apartment building like make as much stress as possible and be prepared to an interview being offensive not supportive or just interrupting you but it's not about yourself it's about this like special like interview style so don't don't lose a call and remember it's just an interview it doesn't matter much you just go there and have some fun and show off your abilities so be prepared that your interview are going to be a complete like you say it something and say oh no this is not how it works i said okay i understand i don't have enough experience maybe i'm wrong i'll go check it out yep any any other questions you still have some time yeah so denise says this is worse nightmare this is not personal it's it's all depends on how you perceive the notation if it's like oh they say something and you immediately took it personally and you gave it up so this was a very interesting case i said what if user never comes offline and eugene's like okay we cannot do anything and he gave up why because it seems like anything he suggest is wrong but there's so many things you can do the user never goes online but for example their computer goes so why would we add like some kind of a cable sync or maybe provide the stop app which can transfer the photos and helps them sync well you don't have a internet but your relative scan so why can you just like put devices together and just transfer some photos so there's lots of lots of things you can do but never give up try to speculate at least it's going to be fun and like this is a signal of the like imagine you provide signals the interview is not expecting to have any robust solution but the signal you provide like the kind that never gives up so i stepped on his throat but he still he keeps going his spirit is high like speculate like do whatever it takes but but never say oh i don't know i give up that's that's the best signal because this what might happen in actual like job when you face a very challenging problem i have no idea anyone else how different l five and six systems interviews uh it's really hard for me to tell um but in my understanding uh when so there are a couple of levels when you can face the system design interview so there is no point of asking someone level 3 to design anything because they most likely not have any experience so at l4 an interview might be optional so you might say i only want to trade one of my coding rounds for and system design my work might not but you can ask and then like for l4 you can go we go happy bus you have internet you have big disk space and you might want to design some screens so like they would say if you would use like a view model here or like which architecture pattern would you advocate for viper for example would you mention rips something like that so it's like very very true example because you would not expect the candidate to actually have the experience well when you start an l5 you already expect them to provide some value right so they now they started talking about um unhappy bus so what if the internet connection is funny what if this space runs out what if we crash in the middle right something like this right so it's it's still kind of toy problem maybe on a bigger scale but now you think about unhappy paths and you think about like oh what exactly we can do and just go a bit broader on l6 those people they might be expect to be less technical because they might not be doing any hands-on work for a little while so they might know about latest libraries latest languages etc but now they're thinking about business case more so they're moving from how like how to build it to what we're going to build right so this is why you ask what's the audience like what's the team size like uh is there any limitation deadlines is there any prior work in the company this is something we can reuse and then it's you use thinking about uh omg scenarios like oh my god what happens if you like had uh like some functionality and then you deliver it and os changes and now it shows an exception with an actual case with android when android r was released if you try to use some telephony api without a permission it would throw a runtime exception security exception so imagine now all your clients crashing what what are you going to be doing so you can't deploy anything so now you said about experimentation maybe like stage rollouts and like all kinds of things so you're not just thinking like what uh vendor to use like what database to use like how many files you're gonna store you're thinking about business case and you're thinking it's like in a rainy day so what the worst thing can possibly happen what if you have privacy breach what if someone get an access to your photo what are you gonna do and the higher you go you should ask like less questions so you should provide more solutions that you generate problems the longer you go like you can get some slack and go like closer to the metal thank you guys a few more fun videos yeah have four minutes left anything else eugene i i think you did a terrific job like you're still learning i think you did a terrific job you're still learning and this whole interview was deliberately designed to make you nervous like next time i would try to be more of i would interrupt you i would question your cognitive abilities but you should be prepared for this okay got it all right anyone else all right i guess that was good i'll see you guys maybe next time yeah goodbye guys