Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should graph data be generated in the back end or front end?

I've been having a discussion recently in the office, about whether to provide graph data prepared via our internal back-end api or to provided generic data and parse to graph format in the front-end. Here is the basic notes i've collected from my team:

Front End Pros:

  • Data is transmitted from the backend in a generic format
  • Because the data is in a generic form, any graph rendering front-end could be used. Provided a parser method is written

Front End Cons:

  • Front-end will need to included a parser of some sort, to convert the generic data into actual graph data

Back End Pros:

  • Data can be provided in the correct format negating the need for front-end parsing

Back End Cons

  • Locks down which graph library we can use

It seems as though its an either/or scenario, but i wanted to ask the question to gain any other possible insights.

By back-end i mean REST API and by front-end i mean web-application (Javascript).

like image 547
bigtallbill Avatar asked Aug 12 '14 19:08

bigtallbill


People also ask

Should data be formatted in the backend or front end?

In general, depending of the current load of the backend, I prefer to distribute the effort in both back and front-end. Nowadays browser have decent performances and unless you have to order million rows it's acceptable. Also, depending on your needs, you can cache your formatted data on server-side.

What is difference between front end and back end?

Front and back end developers work on different sides of a website. Front end development is programming which focuses on the visual elements of a website or app that a user will interact with (the client side). Meanwhile, back end development focuses on the side of a website users can't see (the server side).

How data goes from frontend to backend?

Frontend and backend communicate with each other - via Http requests. The frontend will, for example, send entered data to the backend. The backend might then again validate that data (since frontend code can be tricked) and finally store it in some database.

Is a database front end or back end?

The back-end, also called the server-side, consists of the server which provides data on request, the application that channels it, and the database which organizes the information. For example, when a customer browses shoes on a website, they are interacting with the front end.


1 Answers

  • expensive computations or any sort of computations for graph should happen on the back-end. Even if the back-end ends up consuming more memory or cpu, you can control that by scaling/autoscaling your back-end servers based on CPU, Response time , Memory, etc..
  • If front-end does the computations and lets assume it has years and months of data points, processing happens on the client's browser app for which your app has no control too. This is especially the scenario for those who play multiple browser tabs or apps at the same time.
  • Debugging or pin pointing the issue is easier if all computations are done on the back-end.
like image 177
user1540256 Avatar answered Oct 19 '22 22:10

user1540256