Hello All. Need you brilliant suggestion(s)/design model(s) on this following problem statement please:
Suppose there are various data sources such as internal DB(s) as well as outside/3rd party corporations such as Google, Facebook, Amazon etc. Each of these Data sources may or may not have any common way to publish their data to the vendor(s). And what I ment by that is, may be the vendor needs to consume RESTful services to fetch/collect the data from those sources and/or may have to run SQL Query to get the required data set/resultset at the same time.
Moreover, these list of internal and external data sources (DB instances, Google, Facebook, Amazon etc) also may change (add or delete) in future as needed.
Now, I am working on the Vendor side My task is to propose an API (sort of) which will communicate all those various sources (as needed) and make the date available in such a way that Middle layer (business layer)/UI developers will not have to worry about various Data sources/Data type at any given time (means let's say, in all cases they will just receive data in JSON format, and that all for them to play with).
Please advise me about the available/best technology or the best design architecture which I should follow to create such a dynamic layer (sort of DAO layer) to support this above problem statement.
I will really appreciate your thoughts and suggestions. And Thank you so much.
I'm a big fan of creating repository interfaces. You create an interface that's responsible for CRUD operations for some type of object. For instance, a repository of employees:
Any dependent classes in your business layer then just request an instance of a repository through their constructor:
An example application could instantiate concrete repository implementations and passes them to the classes that need them:
The neatest option is to use some kind of dependency injection framework to handle the life-cycle of your dependencies. Instead of a main class that creates concrete instances of your dependencies, you configure the framework to inject them when needed. An example of such a framework is Spring Framework.