简体   繁体   中英

How much javascript is too much

I have recently been working with someone on a project that is very ajax intense. All calls are made to web services using ajax and the data logic is handled on the client side. The server side code just acts as the data access layer and does little else. How much javascript is too much?

Javascript may be too much when it reveals too much to the client, so I would look from the security perspective. From the performance perspective in general using Javascript is better.

It really depends on your needs and the user's expectations. My only suggestion is to think of the places you are doing AJAX when the user instead really expects to navigate a new page. Those are the cases where you are doing "too much".

Remember, the user spends 99% percent of his time using other sites, not yours. Make sure your site does what he/she expects from the rest of the web as well as from using computers in general.

By the way, usability testing can be used to figure out "what the user really expects" in any area. Your judgments as a designer are likely completely different than typical users'; see also Why You Only Need to Test with 5 Users .

If the resultant application is intuitive and useful to the user, then you cannot say that it has used too much of one technology or another.

Delivering great user experience is what our main goal as software developers should be . The technology we use to do that is just an enabler.

We have only used too much of/the wrong technology if:

  1. the application is unintuitive or deviates from the users' mental model, or
  2. the application is overly difficult or too expensive to maintain for those that come after us

我不介意使用javascript,只要它不暴露敏感信息或打开安全漏洞。

The question is rather, does the application still provide necessary features like bookmarkability and honoring the users browsing history?

If the user cannot bookmark a specific page/state, that should be bookmarkable, that'S a warning sign.

Also not being able to sensibly use the Back button can cause grief.

I would say that for any technique, if you are ignoring a more straightforward method of solving a problem in favour of doing everything 'the same way', there's a good chance you're over doing it. An easy way to prove this is to take some extra time to write a proof of concept feature not using the method in question and keep track of how long it takes you, etc. If you can accomplish the same thing with your proof of concept and deliver a suitable experience to the user, then the development strategy may need to change.

Too much of anything is:

When you can't read the code

When the user doesn't get/need/like/etc the UI

When you are killing whatever server side/client side resources you need

This really depends on what the project is for.

Who are the users? Is this only an internal thing or will it be open to the world? Are they expecting a regular web style interface? Will that get in the way of there usability of the sight?

How secure does it need to be? Using javascript opens a lot of your app to the users which can be a security concern.

Can the typical users machine handle that much javascript (older machines can be almost useless with a lot of javascript)?

There are a lot of questions that need to be answered before you can decide how much javascript is too much.

In the end it will most likely end up being decided by tests and user feedback.

It depends on a number of factors:

  • Does the script reveal information to the end user about the inner workings of your app?
  • Do you need to support a wide range of browsers?
  • Do you need to support mobile users (or PDA's)?
  • Do you enforce business logic with Javascript? (generaly this should be done at the server)
  • Etc.

Once you've got an answer to those questions, I think it is easy to determine wheter you've crossed a line somewhere or not. Besides this, from a performance point of view, distributing the processor load to the client is always a good thing. Enforcing client-side business logic is also fine, but make sure you double-check on the server.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM