I am a web developer, and I noticed that many times I need the same function on both the client and the server. Therefore, I write it in JS as well as in PHP or any other server-side language. I'm tired of it. If I need to change it, I need to change it in both places. If I want to use it for some hand-held devices, I will have to rewrite this code again using objective-C or Java, etc. Then, if I need to change this function, then I will need to change it everywhere.
Is there a solution for this? If I call some web service through ajax, the client will have a delay. If it will be in JS, then it cannot be accessed from PHP or Java, etc. If I use some service in PHP from another language, this can also become a performance issue.
It is also possible that for some time we need functions derived from some parameters as input using db or without db.
I know that it would be a fairly simple solution, but I do not know about it. Please tell me some kind of language-independent solution, since I do not have VPS.
I am not sure if my question really belongs to stackoverflow.com or programers.stackexchange.com, so please transfer it to programers.stackexchange.com, and do not close this question if it belongs.
Hafiz
source share