T
The alMIGHTY N
Hi all,
Let's say I have a simple math formula:
sum (x * y / 1000) / (sum z / 1000)
I have to do this across 50 items, each with an x, y and z value, when
the page first loads AND when a user modifies any of the x, y and z
values.
Needless to say, I need to have a Javascript function that handles
this formula to deal with the modifications.
However, I have a choice on page load to either have the database in
which this data is initially stored perform this calculation or to
have the same Javascript function that will handle the onchange event
handle the initial calculation as well.
a) Would it be noticeably faster to do it on the database side?
b) Would that difference be enough to warrant having redundancy on the
calculation?
One of my co-workers feels that it's always better to do calculations
on the back-end period, no exceptions. My other co-worker feels that
it's bad to have the same calculation in two different places,
especially when one place is back end and the other front end, because
that adds to the list of things we need to handle for future
maintenance.
What's your opinion on which is the better way to do things?
Let's say I have a simple math formula:
sum (x * y / 1000) / (sum z / 1000)
I have to do this across 50 items, each with an x, y and z value, when
the page first loads AND when a user modifies any of the x, y and z
values.
Needless to say, I need to have a Javascript function that handles
this formula to deal with the modifications.
However, I have a choice on page load to either have the database in
which this data is initially stored perform this calculation or to
have the same Javascript function that will handle the onchange event
handle the initial calculation as well.
a) Would it be noticeably faster to do it on the database side?
b) Would that difference be enough to warrant having redundancy on the
calculation?
One of my co-workers feels that it's always better to do calculations
on the back-end period, no exceptions. My other co-worker feels that
it's bad to have the same calculation in two different places,
especially when one place is back end and the other front end, because
that adds to the list of things we need to handle for future
maintenance.
What's your opinion on which is the better way to do things?