Rich Client Applications With ASP.NET
2012-09-25 13:43 朱峰(Peter.zhu) 阅读(280) 评论(0) 编辑 收藏 举报Rich Client Applications With ASP.NET
Web Developers can use client-side libraries such as Backbone and Knockout to structure their client-side code better and enable richer client experiences. We point to some resources.
Unlike JQuery, which mainly focuses mainly on DOM manipulation, Backbone.js and Knockout.js focus on separation of concerns in your code, such as separating your data model from the UI elements. Backbone.js helps you create MVC-like structure and provides RESTful persistence. Models allow separation of data from the View, whereas Routers provide convenient routing between client-side pages. Knockout.js on the other hand focuses on declarative bindings (similar to XAML bindings) of your models to HTML elements and dependency tracking – this allows an MVVM style approach. However both libraries allow other MV* patterns to be followed.
Some resources that could help you get started -
- 20-min presentation of Knockout by Steve Sanders
- Knockout tutorial
- Backbone tutorials
- A sample SPA with Backbone.js and ASP.NET Web API
- Some tips and gotchas for backbone (with ASP.NET)
- A couple of free Pluralsight courses for knockout.js with ASP.NET
These are by no means the only libraries/frameworks available – there are several others, some of which we covered in an InfoQ survey earlier this month. Steve also lists the eight top JS frameworks for rich client-side applications along with interesting comparisons and insights about the direction of the projects.
ASP.NET team is also working on ASP.NET SPA, which was supposed to ship with MVC 4 but couldn't make it. It is currently in preview.
用ASP.NET开发胖客户端应用程序
Web开发者可以使用诸如Backbone及Knockout等客户端库去更好地组织他们的客户端代码,并提供更丰富的客户端体验。我们指出了一些资源。
与主要关注DOM操作的JQuery不同,Backbone.js及Knockout.js则关注在你的代码中实现关注点分离,例如从用户界面元素中将你的数据模型分离出来。Backbone.js帮助你创建像MVC一样的结构,并提供REST风格的持久性。模型允许从视图中分离数据,而路由器为客户端页面之间的路由提供了便利。另一方面,Knockout.js关注的是声明式绑定(与XAML绑定类似),即将你的模型绑定至HTML元素,并保持依赖项跟踪——这样就可以使用MVVM风格的方法。然而,两个库都允许遵循其他的MV*模式。
一些有助于你入门的资源——
- Steve Sanders所作的20分钟的Knockout演讲
- Knockout教程
- Backbone教程
- 用Backbone.js及ASP.NET Web API一起开发的单页应用程序(SPA)示例
- (与ASP.NET一起使用时)针对backbone的一些提示及陷阱
- 几个免费的Pluralsight课程,适用于knockout.js与ASP.NET一起开发
这些绝对不意味着那些是唯一可用的库/框架——还有一些其他的库/框架,其中一些已在本月初的一次InfoQ调查中有所涉及。Steve还罗列了适用于胖客户端应用程序的8个一流JS框架,同时做了有趣的比较,并洞悉了那些项目的未来发展方向。
ASP.NET团队也正在研发ASP.NET单页面应用程序(SPA),此功能本应与MVC 4一起发布,不过未能完成。目前仍是预览版。