I am in need to develop a application which is used to access(get data from) web accessible resources like twitter,facebook,linkedIn,Salesforce etc. by using their appropriate REST API's. Can anyone please suggest me the pattern and architecture to design the logic of the application?
Since you are coupling with many online providers, there's increased chance that their API implementation changes overtime.
Provider
class. Create an abstraction between this Provider
and your actual process (where you use this data once you get it). This Provider
will act as a source of data for the rest of the application. So any changes to API service will not affect your whole application. Model
that represents the data from API services and pass the Model
object between Providers
and Consumers
. Something like this
public interface IFBConnect {
public FBData GetFBData();
public bool PostFBData();
//etc. etc
}
public class FacebookProvider : IFBConnect {
public FBData GetFBData() {
//call the webservice
//parse the JSON to your model object
return FBData
}
}