We have developed a job-portal where users can view jobs and and also post jobs. We have used Php and MySQL. We hosted this on web faction. Now we want to develop the mobile app of the job portal for android, ios and windows. As the database should be synchronous and aligned dynamically with apps and website database. As the back-end code has to be changed to Java in android and c# in windows, how to manage a single synchronous database?
You need a Service Oriented Architecture. Because you are sharing data across all those platforms, Web Services..
Basically rather that calling a "function" you make an HTTP request to a URL, parameters are passed in via the query string or Http header. XML or JSON is returned. Read up on it.
Thing is, your app need to be online at all times...
There are several ways to manage that.
At the lowest level, you can let the database server take care of it. If all applications connect to the same database on the same server and you correctly use SQL transactions, the MySQL server will ensure everyone sees a consistent view of the database.
But if you already need the internet connection to reach the database, why not have there a single web-server that manages the business logic together with the database access and returns the results in a format digestible for the various front-ends (android app, ios app, windows program, website). That way you only have to write the business logic once and only the front-end specific presentation code has to be written for each supported platform.
You need to make your php based web application 'service-oriented', i.e. it acts as a web service endpoint and only processes requests and responds with XML/JSON/text data. This interface will be available for use to both your mobile application and your web application (use ajax to communicate with the service).
In this case your web-application and mobile-application act as presentation layer for the data received from the web-service. However, because of how crawlers parse web sites, your ajax based web-application will not be readable by them. If you need your web-application to be readable by the crawlers then you need to introduce another layer that interacts with the web-service and presents the information as general HTML based page.
So your web app will be like:
Client >> Presentation-Layer (js) >[HTTP]> Service-Layer (php) >> DB (MySQL)
Client >[HTTP]> Presentation-Layer (php) >[HTTP]> Service-Layer (php) >> DB (MySQL)
if you want it to be parsable by crawlers.
And your mobile app will be like:
Client >> Presentation-Layer (java/obj-C) >[HTTP]> Service-Layer >> DB (MySQL)
You can also connect remotely to your main database from both the web application as well as the mobile application, but its not recommended form a security point of view, and you will also need to re-implement all logic on both the web and mobile application.
protected by World Engineer Oct 22 '13 at 12:41
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?