AJAX挫折,服务器和客户端脚本之间的界限?界限、脚本、客户端、挫折

2023-09-10 17:44:35 作者:浮生未歇@

我一直在开发我的第一个基于Web的应用程序,大约两个月了(我是谁大多经历了C和Python和Java的一些扔在启动本科的学生)。到目前为止,我的网页可以作为一个薄的HTML布局(薄意一个非常简单的布局,又名不到50行的HTML),这在很大程度上操纵AJAX,主要是使用jQuery。阿贾克斯是通过产生。 PHP与SQL操作组合。这个Web应用程序将使用最多6-10客户端(编辑:用户),和跨浏览器的兼容性仅仅是一个奖金;似乎IE7是最薄弱的环节。

I've been developing my first web based app for about two months now (I'm an undergrad student who is mostly experienced with C and Python with some Java thrown in to boot). So far my page works as a thin HTML layout (thin meaning a very simple layout, aka less than 50 lines of HTML) which is manipulated heavily by AJAX, primarily using jQuery. The AJAX is generated via. PHP in combination with SQL manipulation. This webapp will be used by a maximum of 6-10 clients ( users), and cross-browser compatibility is just a bonus; it seems IE7 is the weakest link.

我想知道:

什么是使用这种客户端重的方式与更多的浏览器的负载(请注意,我用烧烤应对前进/后退/重装/书签/历史AJAX的断裂)的缺点。在我的简洁性作为一种新的编程努力养成良好的行为,我应该注重自己的长处对AJAX的原则是什么? 是web开发的未来真的动为重向浏览器作为平台,我似乎感觉到了吗?从我的经验,它似乎在JS脚本的客户端使一个像样的GUI工具包,用AJAX支持它作为一个易于使用的数据访问层。 显然,服务器端脚本将永远有它的地方。哪里的服务器端真正大放异彩?例如: a)生成的XML将通过注入。 JS和DOM中 B)将被直接注入生成HTML(无DOM操作) C)创建完整的网页,可以在iframe中使用。 What are the disadvantages of using such a client heavy approach vs. more browser 'loads' (note that I'm using bbq to deal with AJAX's breaking of back/forward/reload/bookmark/history). In my good conciseness as a new programmer trying to develop good practices should I focus my strengths on the principles of AJAX? Is the future of web development really moving as heavily towards the browser as a platform as I seem to perceive it? From my experience, it seem that scripting client side in JS makes for a half decent GUI toolkit, with AJAX backing it up as an easy to use data access layer. Obviously server side scripting will always have it's place. Where does server-side truly shine? eg: a) generating XML that will be injected via. JS and the DOM b) generating HTML that will be injected directly (no DOM manipulation) c) creating full pages that can be used within an iframe.

我想取得一个平衡,似乎一切到目前为止,我所读缺乏平衡的观点,只是推动AJAX作为结束一切,将所有。

I'm trying to strike a balance, and it seems that everything I've read so far lacks a balanced perspective and just pushes AJAX as the end all and be all.

推荐答案

哇,这是严肃的话题等等很多答案是可能的。

Wow, that's serious topic and so many answers are possible.

在同行业中,阿贾克斯和客户端s​​cription用法是作为生产力和可维护性问题作为一个GUI或可用性的工具。 它有时更容易(尤其是在一个MVC服务器ENVIRONNEMENT)来获取内容rahter比所有内容中的一部分。但是,这几乎角度来看问题

In the industry, Ajax and client-side scription usage are as a productivity and maintainability issue as a GUI or usability tool. It's sometimes easier (especially in an MVC server environnement) to get only a part of content rahter than all content. But it's almost question of point of view

我会尽力回答您的3个问题,只记得我很喜欢你在这个意义上,我认为很多文章或一本书真的缺乏平衡(当然,我也一样):

I'll try to answer your 3 questions, just remember I'm like you in the sense I think many articles or book really lacks of balance (obviously, me too) :

要我用客户端重的JavaScript的主要缺点(如建筑物的JS所有的GUI)与服务的HTML页面的服务器是缺乏控制,你得到了错误,小图形的错误,ENVIRONNEMENT差异等你最终会表现得像一个软件供应商发布的桌面应用程序,你不能得到真正控制使用性上的客户端。 当然,这个缺点可几乎完全使用浏览器agonstic框架(像jQuery)和运行在许多环境在渲染测试挣扎。 你应该尝试两种technicles,使用Ajax并非总是最好的,有时它可以挽救你的生命(去构建一个动态树多重选择,只有HTML树枝,将数以百万计)。 我一般我申请规则:如果用户更改屏幕(即之间的列表和表格)我重新加载整个页面,如果不是我使用Ajax。

To me the main disadvantage of using heavy javascript on client (such as building all GUI in JS) versus serving HTML pages from server is the lack of control you get over errors, little graphical bugs, environnement differences, etc. You end up acting like a software vendor distributing desktop applications, you cant get real control over useability on client-side. Of course, this disadvantage can be almost totally struggled using a browser agonstic framework (like jQuery) and running rendering tests in many environnement. You should try both technicles, using Ajax is not always best and it can sometimes save your life (go build a dynamic tree with multiple selections and millions of branches with only HTML). I general I apply this rule : if user changes screen (ie between a listing and a form) I reload the whole page, if not I use Ajax.

我必须同意,在网络的研究与开发,客户端脚本西港岛线仍不断被用于GUI的东西,除了线下的网络解决方案(如齿轮)没有理由的浏览器嵌入数据库或硬的业务逻辑。 业务层是太重要,我们不会依赖浏览器来处理它。数据存储是在相同的位置(再次我)它必须被保持在服务器上。 这种关注点的分离是在我的日常工作​​,我认为这些巨大的责任,绝不可能委托给浏览器,有实在太多的不安全感,不兼容,错误的问题。

I must disagree, in web developement, client side scripting wil still keep being used for GUI stuff, except for offline web solutions (like Gears) there is no reason the browser embeds databases or hard business logic. Business layer is just too important to us to rely on browser to handle it. Data storage is on the same position (again to me) it has to be kept on servers. This separation of concerns is in my everyday job and I think these huge responsibilities can never be delegate to a browser, there is just too much insecurity, incompatibility, bugs issues.

服务器端闪耀在各个阶段我说以下,但作为数据传输格式I preFER直接传送HTML浏览器,或者使用JSON,因为我需要通过任何其他结构化数据。使用XML似乎有点冗长去轻量级的客户端。如果你能避免iframe中,做到这一点,没有理由使用它们在99.9%的情况下我已经看到了。

Server side shines at all stages I stated below, but as for data transfer format I prefer transferring directly HTML to browser or using JSON for any other structured data I need to pass. Using XML seems a little verbose to go for lightweight clients. If you can avoid iframe, do it, there is no reason to use them in 99.9% of cases I've saw.

作为结论的问题,你是学生,学的东西很有意思。如果preFER提高您在客户端的知识,这样做,有很多在这里学习(HTML解析器,DOM和JS的API,浏览器内部真的interresting我)。

As a matter of conclusion, you're student, learn things that are interesting. If you prefer improve your knowledge on client side, do it, there is a lot to learn here (HTML parsers, DOM and JS apis, browser internals are really interresting to me).

但是你要知道,在公司债券我的,网络作为2意义的​​工作:通信和商业应用程序的GUI支持。我目前工作的Web应用程序(内网),我们有3个前端开发人员做PHP和JavaScript,同时也有20人在做服务器端Java。只给你专业的大规模的应用程序所采取的GUI的地方。

But you have to know in corporates I've worked for, the web as 2 meanings : communication and a support for business application GUIs. I currently work for web applications (intranet), we are 3 front end developers doing PHP and javascript while there are 20 people doing server side Java. Just to give you the place taken by GUI in professional wide scale apps.

 
精彩推荐
图片推荐