(February 17, 2018 at 10:11 am)FlatAssembler Wrote: Anyway, when do you think it's advisable to use server-side scripts instead of the client-side scripts?
Of course, sometimes you have to use server-side scripts to store the data (like when making the comment sections or a global high score list on a game), but when should you use server-side scripts to manipulate the data?
If you make an error in a client-side script trying to manipulate the data, the worst thing that can happen is that the browser crashes (which has actually happened to me a few times when using Safari or Internet Explorer). If you make an error in a server-side script, well, your website can easily become inaccessible.
JavaScript can be turned off. A not-insignificant number of people run their browsers with the NoScript plugin (or equivalent) in an attempt to block ads and malicious client scripts.
Regarding errors, program defensively. Exception handling is a thing that's built into just about every language I can think of. Never just blindly accept user input (especially if it's text or a file upload). Run unit tests as you write your code (which, I mean, I've mentioned several times now).
No one doing this for real just writes code and hopes it doesn't break. We take the extra time to account for both errors and malicious users. It's part of the development process.