I was reading an article in .Net Magazine the other day and someone had asked a developer:
“Is it better to run your code on the server side or the client side?”
And the developer said something along the lines of:
“Client side. This will scale better since the users’ computers will do all the work”.
It’s kind of obvious really, but I realised I’ve been doing this wrong. Take my wordcount tool, for example (the design of which is beginning to look a bit crappy to me, which is good, because it means I’m getting better at designing things). It’s built in PHP, which means it uploads all the content to my server and runs the commands on my server.
If you think about it, this is kind of stupid for two reasons:
- I’m having to submit a load of data over the internet, which is slow.
- I’m having to run all the commands on my server. Which doesn’t scale and means my computer is doing the work.
This is a prime example of when doing it on the user’s computer would be better.
PHP isn’t so much a language as a random collection of arbitrary stuff, a virtual explosion at the keyword and function factory