I am an entry level programmer with only a few months of experience. Yesterday I
ID: 646864 • Letter: I
Question
I am an entry level programmer with only a few months of experience. Yesterday I was discussing with a colleague how we can improve the performance of a project we are working on together.
The project is built with C# + Ext.NET + JS
The plan was to move as many things as possible to client-side JavaScript instead of interacting with the server all the time.
I thought this was a good idea, but couldn't help but wonder if there is a point where bringing everything to client-side starts making the web application slower. I understand that interacting with the server and reloading unnecessary data all the time is a waste of time in most cases, but I've also seen websites loaded with so much JS that the browser actually lags and the browsing the web application is just a pain.
Is there a golden point? Are there certain 'rules'? How do you achieve maximum performance? Take Google Cloud apps, such as Docs for example, they're pretty fast for what they do, and they're web applications. That is some very good performance.
Explanation / Answer
Generally, i would say make efficient trips to the server when they're needed, but also use client technologies when it makes sense.. And don't fight it in an effort to "keep it on the client side". So there is no "golden point" since each app will differ in it's needs and user expectations (does the data need to be "live"? or can it get a little stale and be okay). I've also heard things said like "dont optimize it until optimization is requested".
These are some considerations off the top of my head:
-Use client side technologies when your manipulating the client UI, dont ask the server to draw your page state
-pre-load the data when it makes sense, like dynamic menus and drop downs.. but dont pre-load each "details dialog" in anticipation of the user clicking on each "view details" in a grid, unless it makes sense to do so (like if the details are viewed on rollover instead).
-take advantage of any local data storage if available for temporary persistence and only save it to the server when it needs to be persisted to the database (i.e. allow the user to build a purchase order and add line items but dont save it until their done)
-Since you cant trust client validation 100%, you need to validate the data on the server side anyhow, but generally only when its being committed
If you look at the web requests going on with google docs you can see they're making an awful lot of calls to the server. I'd imagine they also have a decent (insane?) amount of horse power ensuring the web requests are as snappy as can be. So the speed of response time should also influence your decisions on how often to make requests to it..
Hope it helps..
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.