Is it correct to leave the responsibility of freight calculation at the front end?

Asked

Viewed 147 times

5

We all know the agility that certain code written on the front end has and makes our applications faster.

It would be correct to calculate a freight at the front end of the application and send this data to the back end?

And, in the back end, we would do a check again to validate this. Of course, without harming the execution on the client. That is, totally outside (the part), can even be implemented in a queue at a certain time of the day or night.

  • 3

    It is not wrong! Doing so would be good for the user to be able to simulate several different calculations... But, it is necessary to do what you said... Validate everything in the back-end, including re-doing the calculation to see if there was any "trickery".

  • 1

    No, but it is necessary to make a final validation in the back-end

  • And in doing so, you temporarily dishonor the server until the user chooses the ideal freight.

  • 1

    Instead of reviewing at a certain time, you can review in an asynchronous way in the back end and depending on the volume of operations you can even allocate a specific server to not impact the system.

  • Yes is what I want the difference between the response time is gigantic can not compare, but always the need to have more code because will have to have two validations even if this can be in certain cases at different times.

1 answer

-3

I believe so.

It would be like validating a password field, for example. We check the size and if it is strong in the front end and then in the back end we make another check if it is correct to insert in the database...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.