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。
- 上一篇:网络安全英文文献和中文翻译
- 下一篇:数据库管理系统英文文献和中文翻译
-
-
-
-
-
-
-
江苏省某高中学生体质现状的调查研究
高警觉工作人群的元情绪...
上市公司股权结构对经营绩效的影响研究
中国传统元素在游戏角色...
现代简约美式风格在室内家装中的运用
C++最短路径算法研究和程序设计
巴金《激流三部曲》高觉新的悲剧命运
浅析中国古代宗法制度
NFC协议物理层的软件实现+文献综述
g-C3N4光催化剂的制备和光催化性能研究