5

I am working on a web application for ranking some products based on some factors.

The user send a search query to 5 restful webservices which by their turn send a response in a JSON format and sometimes in an XML format (responses are not structured the same way, since webservices are different) . I choosed to reformat everything to a special json structure so I can use it .

My current problem is that I don't know which way should I implement this app, which is basically a REST client interfering with other web services .

The Server Approach :

The first way I had in mind is to use a Server side implementation (using python and flask) to send an HTTP request and recieve a response, "ReEncode" everything into a structured json format and send it back to the client which will render it .

Here are the steps of things should work using this approach :

  1. Client send a request to my server containing the search query
  2. My server will reformat the request to create an HTTP request for each web services
  3. The server send the request to these RESTful services and get back an HTTP response from each server .
  4. The server decode those responses to a special data structure I made, then it applies all the ranking and processing logic to it .
  5. The server re-encode everything to json format and send it back to the clients .
  6. The client browser reparse and render the json response !

The Client Side Approach:

The seconde way to create this app is to do all the HTTP communication,data processing,parsing and rendering on a Client side, sure nothing here is really client side, since the app will have to communicate with webservices.

The steps for this approach are as following :

  1. Client type the search keywords (the search Query)
  2. Browser clients create an http request (using the the search Query and API keys) and send it directly to the web services .
  3. Client browser decode the response (json/xml formatted) and creates native objects that I need to use .
  4. Process the decoded data (ranking,filtering...)
  5. Re encode everything to a structured json format
  6. Render everything .

This approach will use only JS and some frameworks .

The Question : Which way is more efficient and quick to set up?

Thing to consider :

  • I have a limited knowledge of python and js.
  • This is a part time project .
  • I need to finish it in less than a month .
  • That's my first web application (but not my first programming project, I've made softwares and games before )
  • Are you saying that the messages passed between client and server will be exactly the same, regardless of whether you implement all the real logic on the client or the server? In that case my default move would be to do everything on the client, simply because the client machines outnumber your servers. But I can easily think of various reasons you might want to stick to the server (takes too long to download the js, sensitive data in the computations, other web services, avoid browser compatibility nonsense, etc, etc) – Ixrec Dec 21 '15 at 22:41
  • 1
    recommended reading: Green fields, blue skies, and the white board - what is too broad? – gnat Dec 22 '15 at 4:34
  • 1
    There isn't enough information in your question to be able to answer which one is more efficient. And ultimately the way to figure it out for your particular application is to do both and then profile them. – user40980 Dec 22 '15 at 4:37
  • 1
    I've edited the question and added a lot more informations, sorry :) – DeltaWeb Dec 22 '15 at 11:45
  • 1
    Voted to reopen as there's enough detail now (and that detail is mostly focused on the architecture rather than the tools), and you've provided specific enough goals that I'm fairly sure someone could offer useful advice now, even if they can't solve your dilemma completely. – Ixrec Dec 22 '15 at 14:42
1

The client-side approach will have the least development time, because you only need to develop one layer (the client). If you would follow the server-side approach, you would have to develop the client and the server. Maybe the number of lines of code would not differ very much, but with the client-side approach you will only have to deal with one program and one programming language. Debugging will be easier, also because there is only one thread.

If I understand you correctly, you are not concerned with the long-term impact of your choice, so I don't consider that in my answer.

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.