Maintainability
While the ideal case can lead to a nice, clean separation of concerns, inevitably some bits of application logic or view logic end up duplicated between client and server, often in different languages。 Common examples are date and currency formatting, form validations, and routing logic。 This makes maintenance a nightmare, especially for more complex apps。
Some developers, myself included, feel bitten by this approach-it’s often only after having invested the time and effort to build a single-page app that it becomes clear what the drawbacks are。
A Hybrid Approach
At the end of the day, we really want a hybrid of the new and old approaches: we want to serve fully-formed HTML from the server for performance and SEO, but we want the speed and flexibility of client-side application logic。
To this end, we’ve been experimenting at Airbnb with “Isomorphic JavaScript” apps, which are JavaScript applications that can run both on the client-side and the server-side。
An isomorphic app might look like this, dubbed here “Client-server MVC”。In this world, some of your application and view logic can be executed on both the server and the client。 This opens up all sorts of doors-performance optimizations, better maintainability, SEO-by-default, and more stateful web apps。
With Node。js, a fast, stable server-side JavaScript runtime, we can now make this dream a reality。 By creating the appropriate abstractions, we can write our application logic such that it runs on both the server and the client-the definition of isomorphic JavaScript。
Isomorphic JavaScript in the Wild
This idea isn’t new-Nodejitsu wrote a great description of isomorphic JavaScript architecture in 2011-but it’s been slow to adopt。 There have been a few isomorphic frameworks to spring up already。
Mojito was the first open-source isomorphic framework to get any press。 It’s an advanced, full-stack Node。js-based framework, but its dependence on YUI and Yahoo!-specific quirks haven’t led to much popularity in the JavaScript community since they open sourced it in April 2012。
Meteor is probably the most well-known isomorphic project today。 Meteor is built from the ground up to support real-time apps, and the team is building an entire ecosystem around its package manager and deployment tools。 Like Mojito, it is a large, opinionated Node。js framework, however it’s done a much better job engaging the JavaScript community, and its much-anticipated 1。0 release is just around the corner。 Meteor is a project to keep tabs on-it’s got an all-star team, and it’s raised $11。2 M from Andreessen Horowitz-unheard of for a company wholly focused on releasing an open-source product。
Asana, the task management app founded by Facebook cofounder Dustin Moskovitz, has an interesting isomorphic story。 Not hurting for funding, considering Moskovitz’ status as youngest billionaire in the world, Asana spent years in R&D developing their closed-source Luna framework, one of the most advanced examples of isomorphic JavaScript around。 Luna, originally built on v8cgi in the days before Node。js existed, allows a complete copy of the app to run on the server for every single user session。 It runs a separate server process for each user, executing the same JavaScript application code on the server that is running in the client, enabling a whole class of advanced optimizations, such as robust offline support and snappy real-time updates。
We launched an isomorphic library of our own earlier this year。 Called Rendr, it allows you to build a Backbone。js Handlebars。js single-page app that can also be fully rendered on the server-side。 Rendr is a product of our experience rebuilding the Airbnb mobile web app to drastically improve pageload times, which is especially important for users on high-latency mobile connections。 Rendr strives to be a library rather than a framework, so it solves fewer of the problems for you compared to Mojito or Meteor, but it is easy to modify and extend。
- 上一篇:网络安全英文文献和中文翻译
- 下一篇:数据库管理系统英文文献和中文翻译
-
-
-
-
-
-
-
当代大学生慈善意识研究+文献综述
酸性水汽提装置总汽提塔设计+CAD图纸
电站锅炉暖风器设计任务书
十二层带中心支撑钢结构...
java+mysql车辆管理系统的设计+源代码
中考体育项目与体育教学合理结合的研究
河岸冲刷和泥沙淤积的监测国内外研究现状
大众媒体对公共政策制定的影响
乳业同业并购式全产业链...
杂拟谷盗体内共生菌沃尔...