D
D
Dmitry Shapoval2015-06-29 17:33:41
Django
Dmitry Shapoval, 2015-06-29 17:33:41

Is it correct to calculate on the server or on the frontend?

I need to make a calculator. example. admin panel for a manager who considers how much it will cost to cook a dish.
in front of it are several drop-down menus with predefined values ​​and input fields.
For example, he chooses tomatoes from the menu.
enters their number in the input field.
enters the number of slices of the tomato. (each cut costs how much).
puts a tick - cook with mayonnaise.
presses the button and the production price is calculated for him.
if everything fits, then another button is pressed and the calculation is entered into the database.
As I see it there are 2 options.
- all this data is already on the frontend and it can calculate everything itself.
- frontend only for data output. on the calculate button - a request is made to the backend with the selected data and the server itself calculates everything and returns the answer.
how do serious guys do it right?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sim3x, 2015-06-29
@unkier

Calculate anywhere
Check on the backend

P
Puma Thailand, 2015-06-29
@opium

count on the front, as it is very slow to request each time on the backend.
in the backend, just get the list and count again so that there is no data substitution hole

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question