Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Desmistificando Herança e Protótipos no JS - Short
Search
Lucas Santos
June 04, 2020
Programming
200
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Desmistificando Herança e Protótipos no JS - Short
Lucas Santos
June 04, 2020
Transcript
62 slides
Desmistificando Herança e Prototypes no Javascript Sempre esteve lá, ninguém
sabia o porquê
$ whoami Lucas Santos /khaosdoctor @_staticvoid lsantos.me Cloud Advocate
[email protected]
@khaosdoctor
trainingcenter.io 2018.abcdevelopers.org
O.O.P
Encapsulamento
None
None
Polimorfismo
None
Arrow functions não vão funcionar
????????
Herança
Herança nos dá isso
Herança nos dá isso De onde veio isso?
De onde as coisas vem?
Tipos originais De onde tudo aparece
Array()
Function()
Object()
String Number Object Array Func RegExp
None
Como elas funcionam?
None
__proto__
Nunca toque no __proto__
Object.Prototype Não. Não é a mesma coisa
Prototype é um objeto de propriedades
O famoso “new”
Instâncias
Instâncias
Instâncias
Instâncias
Instâncias
Herança! Mas não é qualquer herança...
Herança Prototípica
Herança Prototípica
Instâncias
Cadeias de protótipos Como eu sei o que eu quero?
Cadeias de protótipos
Cadeias de protótipos
Cadeias de protótipos
Cadeia de protótipos
Cadeia de protótipos
Cadeias de protótipos: a prática
O fim da cadeia
O fim da cadeia?
E o “extends”?
Extends
Extends
Extends: Exemplo
Extends
O que eu faço com isso?
1. Métodos globais
2. Overload
2. Overload - Os problemas
None
3. Performance
3. Performance .print
3. Performance
3. Performance
Referências - bit.ly/medium-prototypes - bit.ly/ecma-proto - mzl.la/mdn-proto - mzl.la/function-js -
mzl.la/extends-jsx - bit.ly/encapsulamento-js - bit.ly/polimorfismo-js - bit.ly/this-js - bit.ly/imasters-smoosh
/khaosdoctor @_staticvoid lsantos.me @khaosdoctor
More Decks by Lucas Santos
See All by Lucas Santos
The Hitchhiker's Guide for an Amazing API with TypeScript
khaosdoctor
0
150
Escalando globalmente com TypeScript e JavaScript na Klarna
khaosdoctor
0
240
The future of JavaScript
khaosdoctor
0
110
TypeScript tips that could save your life
khaosdoctor
0
280
É hora de falar sobre Deno
khaosdoctor
0
110
JS Software testing for beginners
khaosdoctor
0
120
Ambientes dinâmicos com GitHub Actions
khaosdoctor
0
88
The Dark Side of JavaScript
khaosdoctor
0
110
Integrating Containers Into JavaScript
khaosdoctor
0
100
Other Decks in Programming
See All in Programming
読みやすい!と評判(?)の発表の準備にかける私のこだわり
shoheimitani
0
160
Growing PicoRuby's Ecosystem on ESP32
yuuu
2
150
Spec-driven Development with AI
simas
PRO
0
2.3k
エラーチャンネルのボールを拾い続けて鍛えるエンジニアの地力 / phpcon-niigata2026
meihei3
1
500
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
110
React Native에 현대적인 빌드 도구 더하기: Rollipop 구현기
leegeunhyeok
0
190
AIコーディング時代のKotest ユニットテストから APIレベルの仕様固定化テストへ
ooga04
0
330
AI時代のシニアエンジニアとは
yosuke_furukawa
PRO
15
12k
LLM 101: Exploring LLMs, Starting with Tokens.
dalinaum
0
120
JavaScriptはシングルバイナリの夢を見るか / Does JavaScript Dream of a Single Binary?
ssssota
0
120
はじめてのKubernetesコントリビューション
nasa9084
0
320
自宅サーバはどこまで再現できるのか - Proxmox VE上のVM環境をIaCとバックアップで戻してみた
youto
0
450
Featured
See All Featured
The Language of Interfaces
destraynor
162
27k
Into the Great Unknown - MozCon
thekraken
41
2.8k
AI: The stuff that nobody shows you
jnunemaker
PRO
12
1.3k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
650
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
620
Technical Leadership for Architectural Decision Making
baasie
4
660
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
2k
Discover your Explorer Soul
emna__ayadi
2
1.3k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
360
My Coaching Mixtape
mlcsv
0
390
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.2k