سؤال

When playing with NodeJS, I came up with this question, since one can now put some code either on client side or server side using even the same language.

E.g. For a small game app, I can put the computation on client side when interacting (via some onclick function); also I can initiate a server request and do the computation there.

With more investigation, the terminology for my question is client vs server side rendering. Now there's a lot of materials I can find.

It's basically a tradeoff, depends on the user case, server capacity, etc.

هل كانت مفيدة؟

المحلول

The best philosophy for deciding what is left to the client and what is left server is often to leave as much as possible up to the client. While this often does not apply to very complex applications, most applications can apply this with no negative effects.

The logic here is that 1 dedicated computer (the client) can handle its' individual needs (such as images, video, gameplay) much easier than 1 or a few servers can handle 1000's of client needs.

However, some things require an external application (the server). Good examples of these are sessions, leaderboards, user authentication, and social media integration.

The only downside is that it may increase your applications initial load time. For small applications this may only be milliseconds. For larger applications, that take more than 2-3 second to load, I would say add a loading bar.

Cheers
-Nick

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top