0

I'm building an application that uses as front-end a qooxdoo application which does all the rendering stuff in the browser with javascript. This client-side application only makes calls to the server like this: "get me all the workers" and the server-side returns a list with all the workers in json format..

Now it works like this:

  1. Client makes a request to the server
  2. Server calls the service "workers/get"
  3. The service make a call to the model: Worker.findAll() for example;
  4. The server returns the list to the client.

Now since I've moved all the logic from the services to the Models, I'm asking myself what the services are doing? They are doing nothing and I'm thinking of getting rid of them so the new process would be:

  1. Client makes a request to the server
  2. Server calls the method on the model "Worker.findAll()"
  3. The server returns the list to the client.

That's all, what do you think, I might have problems later on? Thanks (:

Totty.js
  • 15,563
  • 31
  • 103
  • 175

2 Answers2

0

Service does most important thing Co-ordination

  • Model needs to represent the Buisiness Object but not implement logic
  • Logic to Orchestrate the Models needs to be handled by the Business-Service
  • Your MiddleWare or WebLayer Services will interact with the Business-Service along with ValueObjects/RequestObjects - So, they provide a Facade.
TheWhiteRabbit
  • 15,480
  • 4
  • 33
  • 57
  • This is somehow a continuation of my question:http://stackoverflow.com/questions/14276965/should-a-model-change-other-models-or-a-controller-should-change-each-model-ra, The problem I had was that I had job.start() on the model and "jobs/start" as service. The service calls the model job.start() but this is not really starting the job, it's just updating the job model. Then the service updates the Worker model too.Therefore the job.start() is ambiguous because anyone would think that by calling the job.start() on the model would start the job. – Totty.js Jan 30 '13 at 14:46
0

It is impossible to give concrete architecture advice with this little information.

Having said that, I can still give you some advice:

Don't add a layer just for the sake of having it. Only add a specific layer in your application if it makes sense in your context and adds any real benefit.

Daniel Hilgarth
  • 171,043
  • 40
  • 335
  • 443