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
Front-End That Scales - TDC
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Matheus Azzi
October 06, 2016
Programming
160
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Front-End That Scales - TDC
Matheus Azzi
October 06, 2016
More Decks by Matheus Azzi
See All by Matheus Azzi
Give it a REST: Introdução a GraphQL
matheusazzi
0
69
Front-End That Scales - RSJS
matheusazzi
2
170
Teste seu Javascript - Front in SM
matheusazzi
4
160
Teste seu Javascript
matheusazzi
3
310
Iniciando com Ruby
matheusazzi
4
260
Other Decks in Programming
See All in Programming
PHP Application における Kubernetes 内 gRPC 通信
ganchiku
0
520
才能?センス?知らん、 続けたもん勝ちだ。-- 結婚・出産・癌を越えてなお、私がプロダクトを創り続ける理由
16bitidol
2
890
Laravelで学ぶ Webアプリケーションチューニング入門/web_application_tuning_101
hanhan1978
4
1.2k
ローカルLLMでどこまでコードが書けるか -縮小版 / How much code can be written on a local LLM Shortened
kishida
2
200
act2-costs.pdf
sumedhbala
0
120
【やさしく解説 設計編・中級 #4】ルールの寿命と、システムの年輪
panda728
PRO
2
160
「正の参照」と 「負の導出」で組む ハーネスエンジニアリング
cottpan
1
150
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
320
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
4
1.1k
php-fpmのプロセスが枯渇した日-調査・対処・そして本当にやるべきだったこと-
shibuchaaaan
0
110
Prismを使った型安全な暗号化_関数型まつり2026
_fhhmm
0
150
ランチタイムLT会3周年!ランチタイムLT会を3年間続けられたお話
y0hgi
1
150
Featured
See All Featured
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
420
Fireside Chat
paigeccino
42
4k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
730
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
240
Writing Fast Ruby
sferik
630
63k
Docker and Python
trallard
47
4k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
190
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
340
The World Runs on Bad Software
bkeepers
PRO
72
12k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.8k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Transcript
Matheus Azzi Front-End That Scales
Matheus Azzi www.matheusazzi.com matheusazzi fb.com/matheusazzi Codeminer 42 speakerdeck.com/matheusazzi
[email protected]
- Nossas aplicações estão mais complexas e é mais difícil
mantê-las - Não são aplicações triviais
Front-End is Hard - Um único event loop
- Um único event loop - Tamanho da base de
código importa Front-End is Hard
- Um único event loop - transpilamos nosso código para
outra versão - Tamanho da base de código importa Front-End is Hard
- Um único event loop - transpilamos nosso código para
outra versão - Tamanho da base de código importa - Diferentes devices Front-End is Hard
Muito Javascript
Muito Javascript Rodando no Browser
Muito Javascript Rodando no Browser Escrito por muitas pessoas
the app - Code base +5 anos - 63 Devs
- 1.566 Arquivos JS (no vendor) - 5.241 JS specs - 4.428 End-to-End specs - 14.176 Back-end specs - 74.700 commits
Todo código em qualquer aplicação deve parecer como se tivesse
sido escrito por uma única pessoa, independentemente de quantas pessoas tenham contribuído. Rick Waldron Promoting Quality
Promoting Quality - Pessoas vem e vão - Diferentes Skill
sets - Compartilhe o conhecimento - Code Review
USER INTERFACE APPLICATION BACK-END FRONT-END DESIGN Promoting Quality
USER INTERFACE APPLICATION BACK-END FRONT-END DESIGN O front-end jamais vai
escalar se o design não escala Promoting Quality
Mais Funcionalidades == Mais código
Styleguide - Component-driven Development - Componentes isolados para desenvolvimento -
Arquitetura de CSS http://styleguides.io/
Cada alteração feita deve deixar a code base melhor que
estava antes. Sempre aumentar a qualidade, nunca diminuir "Albert Einstein"
_shame.scss
Perceived Performance
Não precisa ser rápido, precisa parecer rápido Perceived Performance
Application Shells
Fake it until Make it
Fake it until Make it
Perceived Performance
Promoting Quality (automatizado) - Code Linters e Smells - Testes
unitários - Testes End-to-End - code coverage
Promoting Quality (automatizado)
None
http://bit.ly/1C46ZKo Promoting Quality
└─ assets/ ├─ images/ ├─ scripts/ ├─ specs/ ├─ styles/
└─ templates/ - Estrutura de diretórios Promoting Quality
└─ assets/ ├─ images/ ├─ scripts/ ├─ specs/ ├─ styles/
└─ templates/ └─ assets/ ├─ feature-one/ ├─ feature-two/ ├─ feature-three/ └─ common/ - Estrutura de diretórios Promoting Quality
├─ feature-one/ │ ├─ header/ │ │ ├─ header-component.js │
│ ├─ header-component-spec.js │ │ ├─ header-ctrl-spec.js │ │ ├─ header-ctrl.js │ │ ├─ header.html │ │ └─ _header.scss │ ├─ dashboard/ │ │ └─ ' ├─ feature-two/ │ └─ ' └─ feature-tree/ └─ ' Promoting Quality
Single File Components └─ components/ ├─ shared/ │ ├─ Sidebar.vue
│ ├─ Header.vue │ ├─ Card.vue │ └─ ' ├─ shopping-cart/ │ ├─ CartBasket.vue │ ├─ CartItem.vue │ ├─ CartSummary.vue │ ├─ Checkout.vue │ └─ ' └─ feature-two/ └─ ' ( Header.vue <header class="header"> <p class="header-greeting">Hello {{username}} )p> <navigation :items="navItems"> )navigation> <user-profile> )user-profile> )header> import Navigation from './shared/Navigation' import UserProfile from './shared/UserProfile' export default { username: 'Matheus', navItems: [ { title: 'Dashboard', url: '/dashboard' }, ' ] } .header { background: #262626; } .header-greeting { font-size: 16px; } Component == HTML + JS + CSS
Be in touch Have a direction
None
Qual Ferramenta Usar?
As decisões mais importantes do projeto são tomadas no início,
quando não sabemos muito sobre ele. Qual Ferramenta Usar?
- Achismos Qual Ferramenta Usar?
- Achismos - Gostos Pessoais Qual Ferramenta Usar?
Você não pode ligar os pontos olhando pro futuro, você
só consegue conectá-los olhando para o passado. Então você precisa acreditar quem em algum momento os pontos vão se conectar no futuro. Steve Jobs
- Escolha as libs com cuidado, elas precisam continuar sendo
mantidas - Pense no seu time, pense na curva de aprendizado - Não seja tão passional - Don't live on the edge Qual Ferramenta Usar?
Qual Ferramenta Usar?
Qual Ferramenta Usar? Nem sempre a "melhor ferramenta" é a
melhor ferramenta para seu projeto.
Feature Flagging - Controlar quais usuários vão ver quais features
- Features mudam, vem e vão - A/B Testing
Feature Flagging - Staff - Early Adopters - 10% dos
usuários - 50% dos usuários - Global Release
Feature Flagging <tabs> <tab-item>Dashboard )tab-item> <tab-item>Profile )tab-item> <tab-item ng-if="currentUser.canAccess('shiny-thing')"> New
*Shiny * Feature )tab-item> <tab-item>Another Feature )tab-item> )tabs>
Feature Flagging - Empregados podem mudar (on/off) essa flag a
qualquer momento
Feature Flagging - Empregados podem mudar (on/off) essa flag a
qualquer momento - Depois do release global a flag é removida se não for necessária
Feature Progression
Feature Progression
Tratamento de Erros Novas Features sempre trazem Novos Erros
Tratamento de Erros
{ "user": { "pets": { "dogs": [ { "name": "Billy"
}, ' ] } } } Tratamento de Erros
var dogName = (user + user.pets + Array.isArray(user.pets.dogs) + user.pets.dogs.length
> 0 + user.pets.dogs[0].name ) , 'Marley'; console.log(dogName); { "user": { "pets": { "dogs": [ { "name": "Billy" }, ' ] } } } Tratamento de Erros
{ "user": { "pets": { "dogs": [ { "name": "Billy"
}, ' ] } } } Tratamento de Erros try { dogName = user.pets.dogs[0].name; } catch (e) { dogName = 'Marley'; } console.log(dogName);
var dogName = _.get(user, 'pets.dogs[0].name', 'Marley'); ( _.get(object, path, default);
console.log(dogName); Tratamento de Erros
Tratamento de Erros - Tenha um error logger
- Tenha um error logger window.onerror = (error, script, lineNumber)
- { $.post('/api/errors', { error, script, lineNumber }) } Tratamento de Erros
Tratamento de Erros - Tenha um error logger
- Frequencia do erro (quantidade) - Device - Último evento
- Qual usuário? - Stack trace Tratamento de Erros
- Promova qualidade - Compartilhe o conhecimento - Automatize a
qualidade - Mantenha um Styleguide - Component-Driven Development - Tenha processos (Code review, 1-1s, ...) - Pense em performance - Estruture por Feature - Feature Flagging - Pense como um time - Minimize os riscos - Logging, Monitore, ...