This is my situationI have a website, mobile client and desktop client.They can all pretty much do the same operations (website might be able to do more now but in the future they might have the exact operation set)The technologies varies: for website ruby, for desktop c#, for mobile objective c and javaI am wondering about two solutions1) create an api that will be used for everyone. website, desktop and mobile. Api is the only one that can connect to the database.2) create an api for dekstop and mobile. Website will connect to the database directlyPersonally I like the approach 1) because I think its more modular and I think that its more consistent. I think the downfall is that it might be a little bit harder to test on the web side and that some features might be harder to implement (like oauth). But overall I think its a better choice.2) is easier for the web programmer obviously but i see some drawbacks like possibly duplicating code for the same thing, not being able to be certain that the same data will be given to all clients (because the code if different) and also we loose some security with direct database access here.I am wondering what do you guys think? And also how do big companies like facebook do it? They have a similar scenario. I guess because they are so large they might choose a more perfomance based solution like 2) but how large do you have to be before you go into that direction?
Best way to design a database interface
database design;api design;ruby;ruby on rails;facebook