Design – Should data transformation be on the front or on the back end in this scenario

designfront-endscalability

Let us say I have some data in a Json format. Let us say the Json format is the following:

{title,
resources[] }

The resources array contains information about a graph. But it should be iterated upon and converted to a different format.

The problem

Given the resources array size is 100, it should be fine and reasonable for the conversion to happen on the front end. What about if the resources arrays size is much bigger ? Could there be a threshold where iteration and converting the data from one format to another should happen in the back end ?

I do have substantial reasoning for passing the conversion responsibility to the front end, but I wonder whether this will scale ?

Supplementary question

What are the main axes my decision where this conversion should reside rely upon? I found a few answers here and here which were good answers but I could use a few more solid arguments.

Best Answer

The decision to do the transformation on the front-end or the backend should depend much more on the kind of transformation that you want to do rather than the number of items involved in the transformation.

As mentioned in the answer by @Ewan, unless you know that your user will use low-power devices to access your application, your users will have enough processing power to do almost any transformation you throw at them.

On the other hand, if the transformation involves deleting sensitive data, then that should really be done on the backend.

Also, if the transformation significantly reduces the amount of data, then it would be better to do it on the backend and reduce the network bandwidth you need.

Related Topic