简体   繁体   English

所描述的开发 web 应用程序的方法有哪些风险?

[英]What are the risks of described approach to developing web application?

We want to write a UI that consists of HTML, Javascript (JQuery) and CSS.我们想编写一个由 HTML、Javascript (JQuery) 和 CSS 组成的 UI。 Although the initial starting point will be served up by a web server, there won't be any sever side templating.虽然最初的起点将由 web 服务器提供,但不会有任何服务器端模板。 The browser will interact with the server via a restful interface and render its UI.浏览器将通过一个 restful 界面与服务器交互并呈现其 UI。

What are the risks of this approach?这种方法有什么风险?

Ideally I'd like a nice, straightforward javascript OO api which underneath makes http calls to the server to get JSON representations of resources.理想情况下,我想要一个漂亮、简单的 javascript OO api,它在下面对服务器进行 http 调用以获取 Z0ECD11C1D7A287A240 Any suggestions as to how this could be structured?关于如何构建它的任何建议?

Anyone have experience with browser side templating?有人有浏览器端模板的经验吗?

Is there a framework to make this style of development easier?有没有一个框架可以让这种开发方式更容易?

We will also be defining the server side resources and my thoughts are to follow ruby on rails conventions.我们还将定义服务器端资源,我的想法是遵循 ruby on rails 约定。 For example, if you define a Users resource in routes.rb, you have 7 uri templates.例如,如果您在 routes.rb 中定义了一个用户资源,那么您就有 7 个 uri 模板。 Any thoughts?有什么想法吗?

By the way, the server side functionality will be developed in java.顺便说一句,服务器端功能将在 java 中开发。

I have plenty of experience with this approach.我对这种方法有很多经验。 I can guarantee you that it works - how well in the long run, I don't know yet but I'm extremely happy with it (as a developer).我可以向你保证它可以工作——从长远来看,我还不知道它有多好,但我对它非常满意(作为开发人员)。

You do need to make sure that you've mastered Javascript.您确实需要确保您已经掌握了 Javascript。 Read up on the state of the art, at least check Douglas Crockford's work, and most notably JSLint.阅读 state 的艺术作品,至少查看 Douglas Crockford 的作品,尤其是 JSLint。

As for frameworks, this is where your vision comes in. We've built one from scratch because we need a combination of tools that existing frameworks don't and because we think we have the vision and expertise to carry it through.至于框架,这就是您的愿景所在。我们从头开始构建了一个框架,因为我们需要现有框架不需要的工具组合,并且因为我们认为我们拥有实现它的愿景和专业知识。 You have to compare the pro's and con's.你必须比较赞成和反对的。 If you use an existing framework you have very little control over it's direction or the speed at which bugs are found and fixed.如果您使用现有框架,您几乎无法控制它的方向或发现和修复错误的速度。 If you build one yourself you could run the risk of making wrong decisions and ending up with a framework that doesn't quite work.如果您自己构建一个,您可能会冒做出错误决定并最终导致框架无法正常工作的风险。

I have noticed that in our applications the custom server side code is only very small.我注意到在我们的应用程序中,自定义服务器端代码非常小。 This means the importance of the backend is only very small (validation, sanity, authorization).这意味着后端的重要性非常小(验证、健全、授权)。 We use PHP, but simply because we have loads of experience with PHP.我们使用 PHP,但这仅仅是因为我们在 PHP 方面拥有丰富的经验。

There are definitely risks.肯定有风险。 In the startup and early transition I have noticed that 'lesser' programmers have trouble catching up.在启动和早期过渡中,我注意到“较小”的程序员难以赶上。 There is a very steep learning curve for anyone not too familiar with Javascript and it's many elegances.对于不太熟悉 Javascript 的人来说,有一个非常陡峭的学习曲线,它有很多优雅之处。

Another risk is performance.另一个风险是性能。 We're advising our customers to use Google Chrome, simply because我们建议我们的客户使用谷歌浏览器,仅仅是因为

And then there is compatibility.然后是兼容性。 The idea of a framework is that it's able to hide this complexity.框架的想法是它能够隐藏这种复杂性。 Luckily browsers are increasing in-tune in accordance to standards but backwards compatibility with (for instance) IE6 is incredibly difficult.幸运的是,浏览器越来越符合标准,但向后兼容(例如)IE6 非常困难。

I would advise against using jQuery.我建议不要使用 jQuery。 I find jQuery more of a 'plugin' than an actual framework.我发现 jQuery 更像是一个“插件”,而不是一个实际的框架。 jQuery really shines when you have a website and you want to sprinkle on some fanciness. jQuery 当你有一个网站并且你想要洒一些花哨的时候真的会发光。 It has some very good general tools (DOM manipulation and all that) but it's very lacking in the business-modeling area.它有一些非常好的通用工具(DOM 操作和所有这些),但在业务建模领域非常缺乏。

I would also advise against an OO approach.我还建议不要使用 OO 方法。 For some very small number of domains OO is the perfect solution.对于极少数领域,OO 是完美的解决方案。 For most businesses, it's not.对于大多数企业来说,事实并非如此。 And Javascript is capable of so much more than just OO. Javascript 的能力远不止 OO。

The #1 problem (and, perhaps, the only problem) is search engine. #1 问题(也许是唯一的问题)是搜索引擎。 It is not sure how well will your content be recognized/crawalble/searchable.不确定您的内容将如何被识别/抓取/搜索。 The underyling cause is that the search engine is not necessarily going to understand your content (since it is only revealed once Javascript gets executed).根本原因是搜索引擎不一定会理解您的内容(因为它仅在 Javascript 执行后才会显示)。

Other than that, it is a great approach.除此之外,这是一个很好的方法。 I tried it several times and it works great (assuming you're not intimidated by Javascript).我试了几次,效果很好(假设你没有被 Javascript 吓倒)。 The resulting web-site is usually much more responsive than traditional web-sites since the server -> client traffic is quite small - only the raw data is transmitted.生成的网站通常比传统网站响应速度更快,因为服务器 -> 客户端流量非常小 - 仅传输原始数据。 All the UI stuff is generated, by Javascript, on the client side.所有的 UI 内容都是由 Javascript 在客户端生成的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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