Ember.js

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Ember.js
Ember.js logo
Original author(s)Yehuda Katz
Developer(s)Ember Core Team
Initial release8 December 2011; 7 years ago (2011-12-08)
Stable release
3.7.3 / February 6, 2019; 8 days ago (2019-02-06)[1]
Repository Edit this at Wikidata
Written inJavaScript
Operating systemCross-platform
TypeJavaScript library
LicenseMIT License[2]
Websitewww.emberjs.com

Ember.js is an open-source JavaScript web framework, based on the Model–view–viewmodel (MVVM) pattern. It allows developers to create scalable single-page web applications[3] by incorporating common idioms and best practices into the framework.

Ember is used on many popular websites, including Discourse,[4] Groupon,[5] LinkedIn, Vine, Live Nation, Nordstrom, Twitch.tv and Chipotle.[6] Although primarily considered a framework for the web, it is also possible to build desktop and mobile applications in Ember.[7][8][9] The most notable example of an Ember desktop application is Apple Music,[10] a feature of the iTunes desktop application.The Ember trademark is owned by Tilde Inc. [11]

Philosophy and design[edit]

From the beginning Ember was designed around several key ideas:

Focus on ambitious web applications
Ember sets out to provide a wholesale solution to the client-side application problem. This is in contrast to many JavaScript frameworks that start by providing a solution to the V in MVC (Model–View–Controller), and attempt to grow from there.
More productive out of the box
Ember is one component of a set of tools that work together to provide a complete development stack. The aim of these tools is to make the developer productive immediately. For example Ember CLI,[12] provides a standard application structure and build pipeline. It also has a pluggable architecture and over 3500 addons[13] to enhance and extend it.
Stability without stagnation
This is the idea that backward compatibility is important and can be maintained while still innovating and evolving the framework.[14]
Future web standards foresight
Ember has been an early adopter and pioneer of many standards around JavaScript and the web including promises,[15] web components[16] and ES6 syntax. Yehuda Katz, one of Ember's cofounders, is a member on TC39, which is the committee responsible for future versions of the JavaScript language.[17]

Like Ruby on Rails, Ember follows Convention over Configuration (CoC), and the Don't Repeat Yourself (DRY) principle.[18] It has been described as a highly opinionated framework built to be very flexible.[19]

Basic concepts[edit]

Ember consists of five key concepts:[20]

Routes
In Ember, the state of an application is represented by a URL. Each URL has a corresponding route object that controls what is visible to the user.
Models
Every route has an associated model, containing the data associated with the current state of the application.[21] While one can use jQuery to load JSON objects from a server and use those objects as models, most applications use a model library such as Ember Data to handle this.
Templates
Templates are used to build the application's HTML and are written with the HTMLBars templating language. (HTMLBars is a variation of Handlebars that builds DOM elements rather than a String.)[22]
Components
A component is a custom HTML tag. Behavior is implemented using JavaScript and its appearance is defined using HTMLBars templates. Components "own" their data. They can also be nested and can communicate with their parent components through actions (events). Other component libraries such as Polymer can also be used with Ember.[23]
Services
Services are just singleton objects to hold long-lived data such as user sessions.[24]

Ember also provides dependency injection, declarative two-way data binding, computed properties, and automatically-updating templates.[25]

Ember 2.0[edit]

Ember 2.0 was released August 13, 2015.[26] The guiding principles for the release were simplification and stability without stagnation.[27] The biggest changes occur in the view layer and include:

  • One way data flow by default. (Referred to as "data down, actions up".[28])
  • "Just refresh it" when something changes.
  • Standard lifecycle hooks for components.

Another major change was the introduction of the Glimmer rendering engine with the aim of improving re-render performance. Glimmer adopts a value-diffing strategy, using a virtual tree of the dynamic areas of the document object model (DOM), similar to React.[29] A number of benchmarks illustrating the speedup in performance have been published.[30]

Since version 1.8 new features identified for 2.0 have been shipped when ready on the 1.x branch, while still maintaining backward compatibility. Features due to be removed in 2.0 have been deprecated. This means that 1.13 contains virtually all 2.0 changes, with 2.0 mainly being about removing deprecated features from the code base.[31] In many cases the removed code is still available in addons.[32]

Ember software stack[edit]

Ember.js is one component of a complete front end stack built and supported by the Ember core team.

Ember CLI[edit]

Ember-cli aims to bring convention over configuration to build tools. A command line utility based on broccoli,[33] running the command ember new <app-name> generates a new Ember app with the default stack. This provides:

  • A standard file and directory structure.
  • Development server with live reload. Out of the box this will automatically rebuild apps incrementally whenever files are changed, and then reload the app in any open browser tabs.
  • A complete testing framework.[34]
  • Dependencies managed via npm.[35]
  • ES6/ES7+ syntax support (using Babel).
  • Asset management (including combining, minifying, and versioning).[36]

Other features include:

  • Blueprints, which are code generators for creating models, controllers, components, and so on that are needed in an application. Custom blueprints can also be created.[37]
  • Addons which provide the ability to extend the features of Ember CLI.[38] Addons can be installed by typing ember install <addon-name>. Over two thousand addons are currently available[39] including addons for CoffeeScript, LESS, Sass, Compass and Mocha.[40]

Ember Data[edit]

Most Ember applications use Ember Data,[41] a data-persistence library providing many of the facilities of an object-relational mapping (ORM). However it is also possible to use Ember without Ember Data.[42]

Ember Data maps client-side models to server-side data. It can then load and save records and their relationships without any configuration via a RESTful JSON API that implements the JSON API specification,[43] provided certain conventions are followed.[44] However it is also easily configurable and can work with any server through the use of adapters and addons.[45] JSON API has server library implementations for PHP, Node.js, Ruby, Python, Go, .NET and Java.[46] Connecting to a Java-Spring based server is also documented.[47]

The first stable version of Ember Data (labelled 1.13 to align with Ember itself) was released on 18 June 2015.[48]

Ember Inspector[edit]

The Ember Inspector is an extension currently available for the Mozilla Firefox[49] and Google Chrome[50] web browsers that claims to make debugging Ember applications easier. Features include the ability to see which templates, components, and views are currently rendered, see the properties of any Ember object with a UI that computes bindings and computed properties, and access your application's objects from the console.[51] If Ember Data is used, one can also see the records loaded for each model.

  • The Object Inspector allows you to view and edit the runtime contents of Ember Objects and Classes.
  • The View Tree visually displays the structure of the rendered Ember application.
  • The Routes tab allows one to determine and follow the router state and the urls used to represent routes.
  • The Data tab can show you the models in your application and records loaded for each model.
  • The Info tab displays versions of your dependencies.
  • The Deprecations tab allows for getting stacktraces of deprecation warnings that do not trigger exceptions.
  • The Promises tab allows for tracing of code through asynchronous operations.
  • The Container tab is useful for checking which objects have been loaded.
  • The Render Performance tab is for determining what is slowing down your Ember application.

Fastboot[edit]

Fastboot is an Ember CLI addon created by the Ember core team that gives Ember developers the ability to run their apps in Node.js. This feature allow end users to see HTML and CSS right away, with the JavaScript downloading in the background and taking over once it has fully loaded.[52]

Liquid Fire[edit]

Liquid Fire provides animation support for Ember applications.[53] Features include animated transitions between routes and between models within a single route. It provides a DSL for laying out spatial route relationships, cleanly separated from view-layer implementation details. A simple example would be to animate a screen transition, so that the new screen appears to slide in from one edge of the browser.[54]

Release process[edit]

Release cycle[edit]

Ember follows a six-week release cycle, inspired by the rapid release cycle of Google Chrome.[55] Every six weeks a new release is made available, and at the same time a beta for the next release is also published. Generally several betas are produced before the next major release comes round, roughly one beta per week.

Starting with Ember 2.0, related projects supported by the core team have their releases coordinated, and share a version number with Ember itself.[56]

Upgrading and backward compatibility[edit]

Ember follows the semantic versioning convention.[57] In particular this means that breaking changes are only introduced at major version numbers such as 1.0, 2.0 etc. While new features can be added at point releases (1.1, 1.2...), and features deprecated, no breaking changes to the public API's are introduced and upgrading within a major version is designed to be as simple as possible. Tooling is also under development to help streamline the upgrade process.[58]

In addition to this process a number of steps were taken to mitigate issues around upgrading to the 2.0 release:

  • All major 2.0 features were in fact introduced early and spread out over a number of releases in order to reduce many of the issues caused by big-bang upgrades.
  • Most features that were removed are still available through addons.

The process follows the core Ember principle of Stability without Stagnation and is in marked contrast to the upgrade plans of similar projects such as AngularJS.[59]

Future development[edit]

Project status can be tracked via the core team meeting minutes.[60] However major changes to Ember go through the Request For Comment process.[61] This gives the Ember community a chance to give feedback on new proposals. Notable RFCs include:

  • Engines.[62] Engines allow multiple logical applications to be composed together into a single application from the user's perspective. Currently released as an experimental addon.[63]
  • Release cycle improvements.[64] Among other things it proposes changes to Ember CLI to support "svelte builds", which will strip out deprecated and unused features.
  • Outlet Focusing.[65] Making Ember accessible by default. This RFC aims to improves the user experience for people using screen readers.

History[edit]

In December 2011, the SproutCore 2.0 framework was renamed to Ember.js, to reduce confusion between the application framework and the widget library of SproutCore 1.0.[66][67] The framework was created by Yehuda Katz, a member of the jQuery, Ruby on Rails and SproutCore core teams. Like many of Katz's other projects, it advocates convention over configuration.

Legacy browser support[edit]

Support for Internet Explorer 8 is available up to version 1.13, but will be dropped from release 2.0 onwards. Internet Explorer 9 and later will continue to be supported.[68] The core team will continue to periodically publish point releases in the 1.13 series to patch security bugs and browser compatibility issues, including issues in IE8.[69]

Corporate sponsorship[edit]

Unlike other projects such as AngularJS (Google) and React (Facebook) which have the backing of one main company, Emberjs has a variety of sponsors. These include Yahoo!,[70] LinkedIn and Bustle which are all major users of the framework.[71]

References[edit]

  1. ^ "Releases · emberjs/ember.js". GitHub. Retrieved 14 February 2018.
  2. ^ "ember.js/LICENSE". GitHub. Retrieved 27 April 2017.
  3. ^ Aghassipour, Alexander; Chacko, Shajith (30 Nov 2012). "Enterprise Apps Are Moving To Single-Page Design". TechCrunch.
  4. ^ "Discourse-Built with Ember.js". GitHub. Retrieved 15 Jul 2015.
  5. ^ "Building With Ember.js at Groupon". TalentBuddy. Retrieved 15 Oct 2015.
  6. ^ http://libscore.com/?#Ember
  7. ^ "Ember-Write Once, Run Everywhere". GitHub. 5 Jul 2015.
  8. ^ "Build better desktop apps with Ember". SpeakerDeck. 5 Jul 2015.
  9. ^ "Wicked Good Ember 2015 talk - Build better desktop apps with Ember, video". 5 Jul 2015.
  10. ^ "Built with ember - Apple Music". BuiltWithEmber. Retrieved 21 Jul 2016.
  11. ^ "Ember.js: Legal". emberjs.com. Retrieved 2019-02-14.
  12. ^ "Ember CLI". Retrieved 15 Dec 2018.
  13. ^ "Ember Addons". Retrieved 15 Dec 2018.
  14. ^ Asay, Matt. "Innovating Fast And Slow: EmberJS Insists, "We Don't Need To Break The Web"". ReadWrite. Retrieved 18 Jun 2015.
  15. ^ "JavaScript Promises". Mozilla. Retrieved 18 Jun 2015.
  16. ^ "Web Components". WebComponents. Retrieved 18 Jun 2015.
  17. ^ "TC39: Members". TC39Wiki. Retrieved 18 Jun 2015.
  18. ^ "What we've learnt from Ember.js after 2 months developing our new product". Solid. Retrieved 3 November 2015.
  19. ^ "Top Reasons Why Industry Experts Use Ember.js And How You Can Adopt It Yourself". TalentBuddy. Retrieved 14 October 2015.
  20. ^ Frank Treacy. "5 Essential Ember 2.0 Concepts You Must Understand". EmberIgniter. Retrieved 31 August 2015.
  21. ^ "Ember.js - Models: Introduction". Emberjs. Retrieved 21 Jan 2014.
  22. ^ Jackson, Robert. "HTMLBars". GitHub. Retrieved 18 February 2015.
  23. ^ "How To Add Polymer To Your Ember Project". ProgramWithErik. Retrieved 11 Aug 2015.
  24. ^ "Ember Services Tutorial". ProgramWithErik. Retrieved 27 July 2015.
  25. ^ Bango, Rey (14 Mar 2013). "Getting Into Ember.js". Nettuts+.
  26. ^ "Ember Releases". Retrieved 15 Dec 2018.
  27. ^ "The road to Ember 2.0". Retrieved 19 June 2015.
  28. ^ "Ember Best Practices: Actions Down, Data Up... wait what?". Retrieved 20 October 2015.
  29. ^ "Glimmer Engine-purpose and implementation". GitHub. Retrieved 19 June 2015.
  30. ^ "Ember performance with Glimmer-before and after". youtube.com. Retrieved 19 June 2015.
  31. ^ "Ember.js 2.0 Released". Emberjs. Retrieved 13 August 2015.
  32. ^ "Ember Legacy Views". Retrieved 19 June 2015.
  33. ^ "Ember CLI". Retrieved 15 Dec 2018.
  34. ^ "Ember testing". Retrieved 15 Dec 2018.
  35. ^ "Ember CLI-managing dependencies". Retrieved 15 Dec 2018.
  36. ^ "Ember CLI asset compilation". Retrieved 15 Dec 2018.
  37. ^ "Ember CLI Blueprints". Retrieved 15 Dec 2018.
  38. ^ "Ember CLI Writing Addons". Retrieved 15 Dec 2018.
  39. ^ "Ember Addons directory". emberobserver.com. Retrieved 15 Dec 2018.
  40. ^ "Ember CLI Overview". Retrieved 15 Dec 2018.
  41. ^ "Ember Data README". Retrieved 4 Dec 2013.
  42. ^ "Ember without Ember Data". Evil Trout. Retrieved 2 Jan 2014.
  43. ^ "JSON API specification". Retrieved 16 Jun 2015.
  44. ^ "Ember.js Models". Emberjs. Retrieved 26 Jun 2015.
  45. ^ "Ember Observer-Data". EmberObserver. Retrieved 16 Jun 2015.
  46. ^ "JSON API implementations". JSON API. Retrieved 26 Jun 2015.
  47. ^ "Integrating Ember.js with the Spring Framework". SpringEmber. Retrieved 26 Jun 2015.
  48. ^ "Ember Data 1.13 release". Retrieved 18 Jun 2015.
  49. ^ "Firefox Addons - Ember Inspector". Mozilla. Retrieved 5 August 2015.
  50. ^ "Chrome Web Store - Ember Inspector". Chrome Web Store. Retrieved 18 Feb 2014.
  51. ^ "Ember Inspector". Ember.js. Retrieved 28 Jun 2015.
  52. ^ "Inside Fastboot. Faking the DOM in node". Emberjs. Retrieved 19 June 2015.
  53. ^ "Liquid Fire: Animations & Transitions for Ember Apps". GitHub. Retrieved 19 June 2015.
  54. ^ "Animations in Ember.js with liquid-fire". airpair.com. Retrieved 10 July 2015.
  55. ^ "New Ember release process". Retrieved 19 June 2015.
  56. ^ "Ember Project at 2.0". Retrieved 19 June 2015.
  57. ^ "Ember API Freeze". Retrieved 19 June 2015.
  58. ^ "Ember Watson Addon". Retrieved 19 June 2015.
  59. ^ "Angular 2.0 announcement". Retrieved 19 June 2015.
  60. ^ "Ember core team meeting minutes". Emberjs. Retrieved 5 Jul 2015.
  61. ^ "Ember RFC process". Emberjs. Retrieved 18 Jun 2015.
  62. ^ "Engines". Emberjs. Retrieved 3 Feb 2015.
  63. ^ "Ember Engines". EmberAddons.com. Retrieved 19 Jan 2016.
  64. ^ "Release cycle improvements RFC". Emberjs. Retrieved 18 Jun 2015.
  65. ^ "Outlet Focusing RFC". Emberjs. Retrieved 18 Jun 2015.
  66. ^ "SproutCore 2.0 becomes Ember.js". The H. 13 Dec 2011.
  67. ^ "Amber.js (formerly SproutCore 2.0) is now Ember.js". yehudakatz.com. 12 Dec 2011.
  68. ^ "IE8 support update". Emberjs. Retrieved 18 Jun 2015.
  69. ^ "1.13 with Extended Browser Support". Emberjs. Retrieved 18 Jun 2015.
  70. ^ "Interview with Mike North, Principle Software Engineer, Yahoo". Emberweekend. Retrieved 10 Aug 2015.
  71. ^ "Ember sponsors". Emberjs. Retrieved 18 Jun 2015.

Further reading[edit]

External links[edit]