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
Matheus Azzi
October 06, 2016
Programming
170
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
71
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
270
Other Decks in Programming
See All in Programming
이 함수, 실패하면 어떻게 되나요? null부터 Rich Errors까지, Kotlin 에러 처리 15년
haeti2
0
120
Go 1.27からのGODEBUG / Go 1.27 リリースパーティ #go127party
mazrean
0
290
Hono + Inertia + React で LP を構築した話
oukayuka
2
200
AI時代に学ぶ 好きなルール 嫌いなルール Linter編
shorty5121
0
800
「AI時代、配布するPythonコードをどう守るか: 難読化の実験と判断軸」 #PyconJP2026
pkshadeck
PRO
2
130
書籍「プロフェッショナルAI駆動開発」紹介スライド
juntaromatsumoto
0
960
自分的「カンファレンスの楽しみ方」
syumai
0
180
iOS開発×AI駆動開発 〜最近使って便利だったスキルの話〜
nogu66
0
140
Building an Out-of-Order CPU
latte72
0
610
バグを直したら useEffect が消えた
colorful12
3
830
Jindong: Introducing Declarative Haptics in Compose Multiplatform
l2hyunwoo
0
140
Can LLMs Replicate 4 Years of Compose Migration? Exploring the boundaries of automation with 279 XML files from a real product
makun
0
130
Featured
See All Featured
Automating Front-end Workflow
addyosmani
1369
210k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2.1k
The Invisible Side of Design
smashingmag
301
52k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
180
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
230
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
470
Music & Morning Musume
bryan
47
7.4k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
390
Everyday Curiosity
cassininazir
0
310
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, ...