Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Ember.js - ответ на почти все вопросы
Search
fwdays
April 29, 2014
Programming
0
2k
Ember.js - ответ на почти все вопросы
Андрей Листочкин
fwdays
April 29, 2014
Tweet
Share
More Decks by fwdays
See All by fwdays
Symfony best practices и не только Олег Зинченко
fwdays
0
1.9k
Beyond Testing Михаил Боднарчук
fwdays
0
650
Yii2 - на пути от Alpha до GA. Взгляд с практической стороны Александр Бордун
fwdays
0
1.7k
Laravel 4: простота во всем. Евгений Косинский
fwdays
0
860
Маленькая библиотека для большой компании. Антон Шевчук
fwdays
0
3.7k
Phalcon. Что нового? Александр Торош
fwdays
0
970
Выбираем поисковик умом головы. Андрей Аксенов
fwdays
0
1.2k
Past, Present, and Future: The Evolution of PHP Development. Nate Abele
fwdays
0
670
Функциональный тулчейн Nix
fwdays
1
380
Other Decks in Programming
See All in Programming
From Spring Boot 2 to Spring Boot 3 with Java 21 and Jakarta EE
ivargrimstad
0
1.1k
Git Lint
bkuhlmann
4
740
SpringBoot+MyBatisで例外が出たときどこを見るか
syukai
0
110
CircleCIを活用して AWSへの継続的デリバリーを 実践する
coconala_engineer
1
230
0→1と1→10の狭間で Javaという技術選定を振り返る/Reflecting on the Decision to Choose Java Between Scaling from 0 to 1 and 1 to 10
jaguar_imo
2
370
Java 22 Overview
kishida
1
170
1인 개발자로 행복하게 살기 - GDG 송도 헬로월드 2024
benjaminkim
1
5.6k
両面どころかインフラもTSでできるよ ~ 全方位TypeScriptによるプロダクト開発 ~
myfinder
9
3.2k
SwiftUI Performance 不要なViewの再描画と更新を抑える
bigamitiongit
1
160
PHP8.3の機能を振り返る / Review of PHP 8.3 features
seike460
PRO
1
110
GraphQLサーバの構成要素を整理する #ハッカー鮨 #tsukijigraphql / graphql server technology selection
izumin5210
1
180
Changed Rules: Architectures with Lightweight Stores
manfredsteyer
PRO
0
230
Featured
See All Featured
Rebuilding a faster, lazier Slack
samanthasiow
72
8.2k
The Pragmatic Product Professional
lauravandoore
24
5.8k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
501
140k
Testing 201, or: Great Expectations
jmmastey
27
6.3k
Teambox: Starting and Learning
jrom
128
8.4k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
20
1.6k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
240
1.2M
Typedesign – Prime Four
hannesfritz
36
2.1k
Imperfection Machines: The Place of Print at Facebook
scottboms
258
12k
Building Your Own Lightsaber
phodgson
98
5.7k
Mobile First: as difficult as doing things right
swwweet
216
8.6k
The Power of CSS Pseudo Elements
geoffreycrofte
59
5k
Transcript
None
Привет, я Андрей! Программирую на чем угодно, люблю JavaScript и
веб-технологии Соведущий Frontend UA Hangout Архитектор в очках и с бородой
None
Холивары!
DOM + Эффекты + Ajax jQuery Prototype DOMAssistant MooTools
Модули + Widgets Yahoo UI Google Closure jQuery UI Ext
JS
Desktop UI
MVC / MVP / MV* Backbone Knockout Angular Ember React/Om
HTML
Ajax
Острова интерактива
None
Моностраничные приложения
Поле Боя MV*
Веб-клиенты
None
None
None
None
2011
Yehuda Katz
C V M
C V M DAO DAO UNIT TESTABLE
C V M
C V M
C ? M
M C ?
Logic-less Templates 2009 Chris Wanstrath - Mustache.rb Jan Lehnardt -
Mustache.js <h1>Hello, {{username}}</h1>
None
None
Tom Dale
Идея - 2011 Run Loop - SprouteCore MVC - Cocoa
Logic-less Templates + Helpers - Handlebars Data-binding - Metamorph Convention over Configuration - Rails
None
Идея - 2011 Run Loop Cocoa MVC Logic-less Templates +
Helpers Data-binding Convention over Configuration
Идея - 2013 Run Loop Cocoa MVC Logic-less Templates +
Helpers Data-binding Convention over Configuration Routing and Application State Data Access Components
None
MVC Route Model Controller View Template
1. URL - царь горы
URL Смена URLа - событие
URL Смена URLа - событие URL - модуль
URL Смена URLа - событие URL - модуль URL -
глобальное состояние
URL https://myapp.com/posts/1 App.Router.map(function () { this.resource('posts', function () { this.resource('post',
{ path: ':post_id'}); }); });
URL https://myapp.com/posts/1 PostsRoute PostsController <posts> {{outlet}} PostRoute PostController <post>
URL var Post = DS.Model.extend({ title: DS.attr('string') body: DS.attr('string') published:
DS.attr('date') });
URL var PostsRoute = Ember.Router.extend({ model: function () { return
this.store.find('post'); } }); var PostsController = Ember.ArrayController.extend({ … });
URL <ul> {{! posts.hbs }} {{#each post in model}} <li>
{{#link-to 'post' post}} {{post.title}} {{/link-to}} </li> {{/each}} </ul> {{outlet}}
URL var PostRoute = Ember.Router.extend({ model: function (params) { return
this.store.find('post', params.post_id); } }); var PostController = Ember.ObjectController.extend({ … });
URL {{! post.hbs}} <h2>{{title}}</h2> <p>{{format-date published}}</p> <div> {{body}} </div>
2. Асинхронность Promise
Promises var PostRoute = Ember.Router.extend({ model: function (params) { return
this.store.find('post', params.post_id); } });
3. Dependency Injection
Dependency Injection var PostRoute = Ember.Router.extend({ model: function (params) {
return this.store.find('post', params.post_id); } });
Dependency Injection var Session = Ember.Object.extend({...}); App.register('session:main', Session); App.inject('session:main', 'store',
'store:main'); App.inject('controller', 'session', 'session:main'); App.inject('route:app', 'session', 'session:main'); // внутри PostEditController this.session.get('isLoggedIn')
4. Кодогенерация
URL var PostsRoute = Ember.Router.extend({ model: function () { return
this.store.find('post'); } }); var PostsController = Ember.ArrayController.extend({});
5. Объектная модель
Объектная модель Наследование Миксины Прокси-объекты Зависимые свойства Геттеры-сеттеры Алиасы ...
Объектная модель Uniform access principle: obj1 = { inner: {
prop: 'value' } }; obj2 = Ember.Object.create({ inner: { prop: 'value' } }); Ember.get(obj1, 'inner.prop'); Ember.get(obj2, 'inner.prop'); obj2.get('inner.prop'); someOtherObject.get(computed.property')
Объектная модель var Person = DS.Model.extend({ first: DS.attr('string'), last: DS.attr('string'),
full: function () { return this.get('first') + ' ' + this.get('last') }.property('first', 'last') }); tom.get('full') // => 'Tom Dale'
6. MVC
MVC https://myapp.com/posts/1 PostsRoute PostsController <posts> {{outlet}} PostRoute PostController <post>
MVC Init View Templat e Model Route Controller
MVC Init View Templat e Model Route Controller
MVC Init View Templat e Model Route Controller
MVC Init View Templat e Model Route Controller
MVC Data View Templat e Model Route Controller Controller View
MVC Events View Templat e Model Route Controller DOM Actions
Actions Actions
MVC Model Controller Route Application Route Route Route Route View
View View View View Model Controller Model Controller View View View View View View View View View View
MVC
7. Компоненты
Компоненты {{#my-tag param=value}} … {{/my-tag}} {{! components/my-tag.hbs}} ... {{yield}} …
MyTagComponent = Ember.Component.extend
Angular's bi-directionally bound isolate scope, transcluded, element restricted directives Ember
Components
За кадром Поддержка тестирования Инструменты Ember Inspector - Chrome, Firefox
Ember-CLI ember new myapp Broccoli ES6, HTMLBars, JSON API
Заблуждения Не может быть встроен, все или ничего Не имеет
DI Нельзя тестировать Сложно начинать Монолитный
А холивар? голос из зала
Angular JS Routing / Nested Views Консистентное API Простые компоненты
Меньше граблей Большие Open-Source проекты Angular 2.0 догонит Эмбер по ряду пунктов :) но будет несовместим с Angular 1.x :(
Backbone + React/OM сравнимая с HTMLBars производительность общая структура проекта,
не “островки архитектуры в море плохого кода” Эмбер начинают использовать с персистентными структурами данных
Не повторяет ошибок других Принимает решения за вас BB Reasonable
Defaults for 95% case BB ng DI с барьерами ng Понятные директивы ng Одноразовая загрузка данных all Свой рендерринг-пайплайн Knockout ng
Модель разработки - PostgreSQL Tilde, Yapp, Prototypal, Adepar, Instructure, etc.
Релизы по расписанию
Компании 1. Apple 2. Google 3. Yahoo 4. Twitter 5.
Microsoft 6. Groupon 7. Square 8. Zendesk 9. Ballanced 10. Nitrous.io 11. USPO 12. DoD 13. NBCNews 14. Netflix
Проекты 1. Discource 2. Ballanced 3. Travis CI 4. Ghost
None
?