1

i have a question about the following software architecture:

enter image description here

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:

  1. Create a method for the Restful service (GET/POST/...)
  2. Write the method in the Core Framework
  3. 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!

  • What is the purpose of your shared core framework? The core framework should not contain anything that is specific to either the client or the server. – Bart van Ingen Schenau Feb 12 '15 at 9:29
  • @BartvanIngenSchenau thank you for your answer. One example would be creating a new user. This is implemented in the Core-Framework. The core framework should insert the user in the database. But i need this method in the APP-Server and in the client, but i only want to implement it once. But in the first case, the user should be inserted directly to the database, and in the other case, it should be done over the app server – BendEg Feb 12 '15 at 9:38
  • @BartvanIngenSchenau during writing the comment, i recognized, that my idea is "a f***king stupid idea". But you gave me the right hint, thank you. I will rethink the complete architecture. – BendEg Feb 12 '15 at 9:40
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.