Skip to content

Code guidelines

Sojharo edited this page Aug 13, 2015 · 2 revisions

Tables and column names should be similar

We started from web application and defined all the tables and column names there in mongodb. It is a good idea to use these names everywhere to avoid confusion. E.g. In web server, the table name for chat is userchat and columns are like to, from, message etc. So on android, for sqlite database, we used the same names. Also for iOS, we should look at the structure of tables and names in mongodb first and then make identical tables in iOS sqlite database.

We should have modules

Networking code like code which does http post and get requests should be written in a separate module or class so that any part of application can use it to talk to server.

Other important this is of URLs, we have not hard-coded the server URLs on android. We have kept that in variables in a separate class and they are reusable now. We can do something similar in iOS.

Database should have its own module. It should be like an API exposed. It would have functions to store or fetch certain kind of data from sqlite. All the parts of application would use the module to load data from sqlite database.

Processes running in Background

Later, we would have the processes running in background even if the application is closed, our socket.io service will run in background to receive incoming call or chat. This is very high level for now. I am writing it here to make sure you do learning of background services/processes in iOS.

Clone this wiki locally