Skip to content

Instantly share code, notes, and snippets.

@kepek
Forked from samselikoff/future-proof.md
Created January 30, 2016 17:40
Show Gist options
  • Save kepek/c32f61af82ff66d57d0a to your computer and use it in GitHub Desktop.
Save kepek/c32f61af82ff66d57d0a to your computer and use it in GitHub Desktop.

Revisions

  1. @samselikoff samselikoff revised this gist May 29, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion future-proof.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    *This gist is also on [my blog](http://www.samselikoff.com/blog/preparing-for-ember-2.0/), since gist doesn't support @ notifications.*
    *This post is also on [my blog](http://www.samselikoff.com/blog/preparing-for-ember-2.0/), since Gist doesn't support @ notifications.*

    ---

  2. @samselikoff samselikoff revised this gist May 29, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion future-proof.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    *This gist now lives on [my blog](http://www.samselikoff.com/blog/preparing-for-ember-2.0/), since gist doesn't support @ notifications.*
    *This gist is also on [my blog](http://www.samselikoff.com/blog/preparing-for-ember-2.0/), since gist doesn't support @ notifications.*

    ---

  3. @samselikoff samselikoff revised this gist May 29, 2015. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion future-proof.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,6 @@
    *This gist now lives on [my blog](http://www.samselikoff.com/blog/preparing-for-ember-2.0/), since gist doesn't support @ notifications*
    *This gist now lives on [my blog](http://www.samselikoff.com/blog/preparing-for-ember-2.0/), since gist doesn't support @ notifications.*

    ---

    Components are taking center stage in Ember 2.0. Here are some things you can do today to make the transition as smooth as possible:

  4. @samselikoff samselikoff revised this gist May 29, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions future-proof.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    *This gist now lives on [my blog](http://www.samselikoff.com/blog/preparing-for-ember-2.0/), since gist doesn't support @ notifications*

    Components are taking center stage in Ember 2.0. Here are some things you can do today to make the transition as smooth as possible:

    - Use Ember CLI
  5. @samselikoff samselikoff revised this gist May 29, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion future-proof.md
    Original file line number Diff line number Diff line change
    @@ -38,7 +38,7 @@ Components are taking center stage in Ember 2.0. Here are some things you can do
    - Stay away from two-way bindings and mutability
    - Don't use `each` or `with` in the context-switching form. That is, use

    {{#each user in users}} {{user.firstName}} {{/each}}
    {{#each users as |user|}} {{user.firstName}} {{/each}}

    instead of

  6. @samselikoff samselikoff revised this gist Apr 16, 2015. 1 changed file with 13 additions and 15 deletions.
    28 changes: 13 additions & 15 deletions future-proof.md
    Original file line number Diff line number Diff line change
    @@ -3,34 +3,31 @@ Components are taking center stage in Ember 2.0. Here are some things you can do
    - Use Ember CLI
    - In general, replace views + controllers with components
    - Only use controllers at the top-level for receiving data from the route, and use `Ember.Controller` instead of `Ember.ArrayController` or `Ember.ObjectController`
    - Fetch data in your route, and set it on `attrs` on your top-level controller:
    - Fetch data in your route, and set it as normal properties on your top-level controller. Export an `Ember.Controller`, otherwise a proxy will be generated. You can use Ember.RSVP.hash to simulate setting normal props on your controller.

    ```js
    //controllers/index.js
    import Ember from 'ember';
    export default Ember.Controller.extend({
    attrs: {}
    // don't write any more code for this controller
    });
    export default Ember.Controller;
    //routes/index.js
    model: function() {
    return this.store.find('user');
    return Ember.RSVP.hash({
    users: this.store.find('user')
    });
    },
    setupController: function(controller, model) {
    controller.set('attrs.users', model);
    setupController: function(controller, models) {
    controller.setProperties(models);
    }
    ```
    then use `attrs.[model]` in your route's template:
    Now you can just refer to the keys in your route's template:
    ```hbs
    //templates/index.js
    <h1>Users</h1>
    {{user-list users=attrs.users}}
    {{user-list users=users}}
    ```
    This controller/template pair will eventually become a routable component.

    @@ -46,9 +43,10 @@ Components are taking center stage in Ember 2.0. Here are some things you can do
    instead of

    {{#each users}} {{firstName}} {{/each}}
    - Use `this.route` instead of `this.resource` in `Router.map`
    - Use pods

    - Use pods
    - Use `this.route` instead of `this.resource` in `Router.map`. Couple this with pods and you'll quickly understand why you don't want to use `resource` anymore - your directory structure in `pods` will now mirror the view hierarchy of your UI.


    **Better apps**

  7. @samselikoff samselikoff revised this gist Dec 1, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions future-proof.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    Components are taking center stage in Ember 2.0. Here are some things you can do today to make the transition as smooth as possible:

    - Use Ember CLI
    - In general, replace views + controllers with components
    - Only use controllers at the top-level for receiving data from the route, and use `Ember.Controller` instead of `Ember.ArrayController` or `Ember.ObjectController`
    - Fetch data in your route, and set it on `attrs` on your top-level controller:
    @@ -26,7 +27,7 @@ Components are taking center stage in Ember 2.0. Here are some things you can do
    then use `attrs.[model]` in your route's template:
    ```js
    ```hbs
    //templates/index.js
    <h1>Users</h1>
    {{user-list users=attrs.users}}
    @@ -35,7 +36,6 @@ Components are taking center stage in Ember 2.0. Here are some things you can do

    - In your templates, stay away from things like `ItemController`s and calls to `render()`. Use components instead.
    - Don't use views
    - Use Ember CLI
    - Write your app in the "data down, actions up" paradigm
    - Not currently enforced, but you can still structure your app this way
    - Stay away from two-way bindings and mutability
  8. @samselikoff samselikoff revised this gist Dec 1, 2014. 1 changed file with 33 additions and 2 deletions.
    35 changes: 33 additions & 2 deletions future-proof.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,39 @@
    Components are taking center stage in Ember 2.0. Here are some things you can do today to make the transition as smooth as possible:

    - In general, replace views + controllers with components
    - Only use controllers at the route level, and use `Ember.Controller` instead of `Ember.ArrayController` or `Ember.ObjectController`
    - Stay away from things like `ItemController`s and calls to `render()`. Use components instead.
    - Only use controllers at the top-level for receiving data from the route, and use `Ember.Controller` instead of `Ember.ArrayController` or `Ember.ObjectController`
    - Fetch data in your route, and set it on `attrs` on your top-level controller:

    ```js
    //controllers/index.js
    import Ember from 'ember';
    export default Ember.Controller.extend({
    attrs: {}
    // don't write any more code for this controller
    });
    //routes/index.js
    model: function() {
    return this.store.find('user');
    },
    setupController: function(controller, model) {
    controller.set('attrs.users', model);
    }
    ```
    then use `attrs.[model]` in your route's template:
    ```js
    //templates/index.js
    <h1>Users</h1>
    {{user-list users=attrs.users}}
    ```
    This controller/template pair will eventually become a routable component.

    - In your templates, stay away from things like `ItemController`s and calls to `render()`. Use components instead.
    - Don't use views
    - Use Ember CLI
    - Write your app in the "data down, actions up" paradigm
  9. @samselikoff samselikoff revised this gist Nov 17, 2014. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions future-proof.md
    Original file line number Diff line number Diff line change
    @@ -17,6 +17,7 @@ Components are taking center stage in Ember 2.0. Here are some things you can do
    {{#each users}} {{firstName}} {{/each}}
    - Use `this.route` instead of `this.resource` in `Router.map`
    - Use pods

    **Better apps**

  10. @samselikoff samselikoff revised this gist Nov 17, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion future-proof.md
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ Components are taking center stage in Ember 2.0. Here are some things you can do
    - Don't use views
    - Use Ember CLI
    - Write your app in the "data down, actions up" paradigm
    - Not enforced, but you can still structure your app this way
    - Not currently enforced, but you can still structure your app this way
    - Stay away from two-way bindings and mutability
    - Don't use `each` or `with` in the context-switching form. That is, use

  11. @samselikoff samselikoff revised this gist Nov 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion future-proof.md
    Original file line number Diff line number Diff line change
    @@ -22,4 +22,4 @@ Components are taking center stage in Ember 2.0. Here are some things you can do

    Follow these tips, and your apps will be ready for Ember 2.0. You'll also learn a lot about writing apps that are better structured and easier to understand!

    Deprecations will be coming to help you move away from these practices. The goal from the team is, if your app runs on the final version of 1.x with no deprecations, it should be able to run in 2.0.
    Deprecations will be coming to help you move towards these newer practices. The goal is, if your app runs on the final version of 1.x with no deprecations, it should be able to run in 2.0.
  12. @samselikoff samselikoff revised this gist Nov 16, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions future-proof.md
    Original file line number Diff line number Diff line change
    @@ -12,9 +12,9 @@ Components are taking center stage in Ember 2.0. Here are some things you can do

    {{#each user in users}} {{user.firstName}} {{/each}}

    instead of
    instead of

    {{#each users}} {{firstName}} {{/each}}
    {{#each users}} {{firstName}} {{/each}}
    - Use `this.route` instead of `this.resource` in `Router.map`

  13. @samselikoff samselikoff revised this gist Nov 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion future-proof.md
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ Components are taking center stage in Ember 2.0. Here are some things you can do
    - Stay away from two-way bindings and mutability
    - Don't use `each` or `with` in the context-switching form. That is, use

    {{#each user in users}} {{user.firstName}} {{/each}}
    {{#each user in users}} {{user.firstName}} {{/each}}

    instead of

  14. @samselikoff samselikoff revised this gist Nov 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion future-proof.md
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ Components are taking center stage in Ember 2.0. Here are some things you can do
    - Stay away from two-way bindings and mutability
    - Don't use `each` or `with` in the context-switching form. That is, use

    {{#each user in users}} {{user.firstName}} {{/each}}
    {{#each user in users}} {{user.firstName}} {{/each}}

    instead of

  15. @samselikoff samselikoff revised this gist Nov 16, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions future-proof.md
    Original file line number Diff line number Diff line change
    @@ -9,8 +9,8 @@ Components are taking center stage in Ember 2.0. Here are some things you can do
    - Not enforced, but you can still structure your app this way
    - Stay away from two-way bindings and mutability
    - Don't use `each` or `with` in the context-switching form. That is, use
    -
    {{#each user in users}} {{user.firstName}} {{/each}}

    {{#each user in users}} {{user.firstName}} {{/each}}

    instead of

  16. @samselikoff samselikoff revised this gist Nov 16, 2014. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions future-proof.md
    Original file line number Diff line number Diff line change
    @@ -8,9 +8,8 @@ Components are taking center stage in Ember 2.0. Here are some things you can do
    - Write your app in the "data down, actions up" paradigm
    - Not enforced, but you can still structure your app this way
    - Stay away from two-way bindings and mutability
    - Don't use `each` or `with` in the context-switching form
    - e.g. use

    - Don't use `each` or `with` in the context-switching form. That is, use
    -
    {{#each user in users}} {{user.firstName}} {{/each}}

    instead of
  17. @samselikoff samselikoff revised this gist Nov 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion future-proof.md
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ Components are taking center stage in Ember 2.0. Here are some things you can do

    instead of

    {{#each users}} {{firstName}} {{/each}}
    {{#each users}} {{firstName}} {{/each}}
    - Use `this.route` instead of `this.resource` in `Router.map`

  18. @samselikoff samselikoff revised this gist Nov 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion future-proof.md
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ Components are taking center stage in Ember 2.0. Here are some things you can do

    instead of

    {{#each users}} {{firstName}} {{/each}}
    {{#each users}} {{firstName}} {{/each}}
    - Use `this.route` instead of `this.resource` in `Router.map`

  19. @samselikoff samselikoff revised this gist Nov 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion future-proof.md
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ Components are taking center stage in Ember 2.0. Here are some things you can do

    instead of

    {{#each users}} {{firstName}} {{/each}}
    {{#each users}} {{firstName}} {{/each}}
    - Use `this.route` instead of `this.resource` in `Router.map`

  20. @samselikoff samselikoff revised this gist Nov 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion future-proof.md
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@ Components are taking center stage in Ember 2.0. Here are some things you can do

    instead of

    {{#each users}} {{firstName}} {{/each}}
    {{#each users}} {{firstName}} {{/each}}
    - Use `this.route` instead of `this.resource` in `Router.map`

  21. @samselikoff samselikoff revised this gist Nov 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion future-proof.md
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ Components are taking center stage in Ember 2.0. Here are some things you can do
    {{#each user in users}} {{user.firstName}} {{/each}}

    instead of

    {{#each users}} {{firstName}} {{/each}}
    - Use `this.route` instead of `this.resource` in `Router.map`
  22. @samselikoff samselikoff revised this gist Nov 16, 2014. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion future-proof.md
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,9 @@ Components are taking center stage in Ember 2.0. Here are some things you can do
    {{#each user in users}} {{user.firstName}} {{/each}}

    instead of
    {{#each users}} {{firstName}} {{/each}}

    {{#each users}} {{firstName}} {{/each}}

    - Use `this.route` instead of `this.resource` in `Router.map`

    **Better apps**
  23. @samselikoff samselikoff revised this gist Nov 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion future-proof.md
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ Components are taking center stage in Ember 2.0. Here are some things you can do
    - Don't use `each` or `with` in the context-switching form
    - e.g. use

    {{#each user in users}} {{user.firstName}} {{/each}}
    {{#each user in users}} {{user.firstName}} {{/each}}

    instead of
    {{#each users}} {{firstName}} {{/each}}
  24. @samselikoff samselikoff revised this gist Nov 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion future-proof.md
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ Components are taking center stage in Ember 2.0. Here are some things you can do
    - Don't use `each` or `with` in the context-switching form
    - e.g. use

    {{#each user in users}} {{user.firstName}} {{/each}}
    {{#each user in users}} {{user.firstName}} {{/each}}

    instead of
    {{#each users}} {{firstName}} {{/each}}
  25. @samselikoff samselikoff revised this gist Nov 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion future-proof.md
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ Components are taking center stage in Ember 2.0. Here are some things you can do
    - Don't use `each` or `with` in the context-switching form
    - e.g. use

    {{#each user in users}} {{user.firstName}} {{/each}}
    {{#each user in users}} {{user.firstName}} {{/each}}

    instead of
    {{#each users}} {{firstName}} {{/each}}
  26. @samselikoff samselikoff revised this gist Nov 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion future-proof.md
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ Components are taking center stage in Ember 2.0. Here are some things you can do
    - Don't use `each` or `with` in the context-switching form
    - e.g. use

    {{#each user in users}} {{user.firstName}} {{/each}}
    {{#each user in users}} {{user.firstName}} {{/each}}

    instead of
    {{#each users}} {{firstName}} {{/each}}
  27. @samselikoff samselikoff revised this gist Nov 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion future-proof.md
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ Components are taking center stage in Ember 2.0. Here are some things you can do
    - Don't use `each` or `with` in the context-switching form
    - e.g. use

    {{#each user in users}} {{user.firstName}} {{/each}}
    {{#each user in users}} {{user.firstName}} {{/each}}

    instead of
    {{#each users}} {{firstName}} {{/each}}
  28. @samselikoff samselikoff revised this gist Nov 16, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions future-proof.md
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,9 @@ Components are taking center stage in Ember 2.0. Here are some things you can do
    - Stay away from two-way bindings and mutability
    - Don't use `each` or `with` in the context-switching form
    - e.g. use

    {{#each user in users}} {{user.firstName}} {{/each}}

    instead of
    {{#each users}} {{firstName}} {{/each}}
    - Use `this.route` instead of `this.resource` in `Router.map`
  29. @samselikoff samselikoff revised this gist Nov 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion future-proof.md
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ Components are taking center stage in Ember 2.0. Here are some things you can do
    - Stay away from two-way bindings and mutability
    - Don't use `each` or `with` in the context-switching form
    - e.g. use
    {{#each user in users}} {{user.firstName}} {{/each}}
    {{#each user in users}} {{user.firstName}} {{/each}}
    instead of
    {{#each users}} {{firstName}} {{/each}}
    - Use `this.route` instead of `this.resource` in `Router.map`
  30. @samselikoff samselikoff revised this gist Nov 16, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions future-proof.md
    Original file line number Diff line number Diff line change
    @@ -9,8 +9,8 @@ Components are taking center stage in Ember 2.0. Here are some things you can do
    - Not enforced, but you can still structure your app this way
    - Stay away from two-way bindings and mutability
    - Don't use `each` or `with` in the context-switching form
    - e.g. use
    {{#each user in users}} {{user.firstName}} {{/each}}
    - e.g. use
    {{#each user in users}} {{user.firstName}} {{/each}}
    instead of
    {{#each users}} {{firstName}} {{/each}}
    - Use `this.route` instead of `this.resource` in `Router.map`