Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Best Language to Perform Basic Calculations

What language is best for a user input data into a form, post that data to a server have that server perform basic calculations (addition and multiplication) then return user input along with the calculated values? When would one use JAVAScript vs Python vs Ruby vs any other server side language?

1 Answer

Oliver Gibbs
Oliver Gibbs
9,771 Points

That could just be done on the client side using javascript - no Post required. If you wanted to ensure support for users with no javascript then any server-side language could process the data from a form - Python, PHP, or Ruby would be fine.

+1. JavaScript is the ideal language for interaction with the user. Since it is client side, the operations occur on the client computer, not the server, and so you can allow for a lot more operations than if you were to implement a server side version. The reason behind this is that if the server has to do all of the calculations for each user, you're going to take up a lot of server resources. I would purely make it a JavaScript application and explain through a <noscript> tag that they must have JavaScript enabled in order to use the application.