i have a question about the following software architecture:
So, there is one database, an app server, which provide a restful service, a client and a framework, used by the app server and the client.
Now i have some problems with the data access in the Core Framework. On the one hand, the Client uses some functions from the core framework and all data has to be transfered over the HTTP-Protocol. On the other hand, the app-server uses the same functions, but should use our O/R-Mapper for reading and writing the datas.
Or do i have to devide API (in the client) and the Core Framework? But in this case, i have to write the same methods, multiple times, for example:
Example for user creation:
- Create a method for the Restful service (GET/POST/…)
- Write the method in the Core Framework
- Write the method in the API
I think, i have some major architecture failures in my plan, do some one has had similar problems and found a solution?
Thank you!
3
Yes, this is a very common architecture so the problem does pop up frequently.
What I would do is that I would introduce a new level of abstraction by defining a “model” for my project which contains and presents the classes that my project deals with irrespective of how they are obtained (via HTTP or ORM.)
On the server, this model would be implemented to fetch data using the ORM.
On the client, the model would be implemented to fetch the data using HTTP.
Then, as much as possible of the functionality of the framework would be built on top of the model, so that the same code can be used both on the client and on the server.