Skip to main content
deleted 1 characters in body
Source Link
kevin cline
  • 33.9k
  • 3
  • 73
  • 143

In a slightly more complex situation, I decided to use AJAX to make sure the calculation is only done in one place, i.e. on the server. Coding the same calculation twice (on the server in C#, on the browser in JavaScript) is code duplication and might negatively affect maintainance; making use of a property of the calulation like you proposed seems even more dangerous because once someone decides that from now on, the formula has to be

 B = A * 1.05 + C

your code will create subtilesubtle errors and probably cause a lot of headaches.

In a slightly more complex situation, I decided to use AJAX to make sure the calculation is only done in one place, i.e. on the server. Coding the same calculation twice (on the server in C#, on the browser in JavaScript) is code duplication and might negatively affect maintainance; making use of a property of the calulation like you proposed seems even more dangerous because once someone decides that from now on, the formula has to be

 B = A * 1.05 + C

your code will create subtile errors and probably cause a lot of headaches.

In a slightly more complex situation, I decided to use AJAX to make sure the calculation is only done in one place, i.e. on the server. Coding the same calculation twice (on the server in C#, on the browser in JavaScript) is code duplication and might negatively affect maintainance; making use of a property of the calulation like you proposed seems even more dangerous because once someone decides that from now on, the formula has to be

 B = A * 1.05 + C

your code will create subtle errors and probably cause a lot of headaches.

Source Link
user281377
  • 28.5k
  • 5
  • 79
  • 131

In a slightly more complex situation, I decided to use AJAX to make sure the calculation is only done in one place, i.e. on the server. Coding the same calculation twice (on the server in C#, on the browser in JavaScript) is code duplication and might negatively affect maintainance; making use of a property of the calulation like you proposed seems even more dangerous because once someone decides that from now on, the formula has to be

 B = A * 1.05 + C

your code will create subtile errors and probably cause a lot of headaches.