Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Databases

Kjetil-Lennart A. Lorentzen
Kjetil-Lennart A. Lorentzen
13,390 Points

Where should we do calculations?

I would say this question is about scaling, i am taking the SQL course and we are learning to do calculations in the queries. should calulations be done on the server-side or client-side? If the project is gigantic, and it has millions of users, would it then make senese that calculating tax etc be done on client-side to relieve the server-side of stress?

1 Answer

Steven Parker
Steven Parker
216,083 Points

If calculations are different for each user, it would certainly make sense to do them on the user side, but the development would be a bit more complex. You'd need to transmit script code along with the data to the client to make it work.

Having everything in one place would make development and maintenance simpler. You'd also want to consider if the result of the calculations are needed by the page layout processes in the server.