I've collected a bunch of interview questions like "Describe how you would design a photo album application", "Describe how you would design this particular feature of this particular website" (e.g. likes on Facebook, recommendation on Amazon, shopping cart, game of black jack). Then, what if there are millions of this thing? What would you change?
It looks like this is either expecting a database schema or a bunch of class definitions (or both?). I have learned about databases in school but I've never actually architected an application before and am having trouble knowing where to start, whether the designs I come up with are "good" and what I can change to make it scalable.
Is there a general approach or thought process when designing these systems? And general issues/problems that seem to come up a lot in the design that I should try to avoid? Could someone maybe walk me through one (or preferably all, while comparing the needs of each) of these and explain:
1) How do you come up with what entities are needed? 2) How do you decide on what relationships everything will have? 3) How do you incorporate performance optimization into your design? 4) Do I do this using classes or databases? Does it make a difference (i.e. would I have a class that can't really be translated to a database table, for example?)
The main reason I'm asking is because I was going through "Cracking the Coding Interview" and my answers were completely different from the author's - I had very different ideas of what classes were important.
MY ATTEMPT: With the photo sharing app, I would have the classes/tables: Photo and User for sure.
Then, I think if we're trying to create a schema, there would be a table linking photo and user if we assume each person in the photo is linked to the photo (is this table necessary? If not, is it still common practice to have a separate table for many-to-many relationships or not?).
But if we're trying to take an object oriented approach, maybe instead we'd have a class called album which does all the work and has all the info from the two other tables/classes. This is one thing I noticed in the book- there are a bunch of classes and then one class which basically has all the info and connects the other classes- is this common? For example, in my examples above, does this seem like it would apply?
I'm just hoping for some general rules/guidelines to follow because right now I have no idea how to tell what a good architecture for a large system looks like.