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
Desmistificando Herança e Protótipos no JS - Short
Search
Lucas Santos
June 04, 2020
Programming
1
150
Desmistificando Herança e Protótipos no JS - Short
Lucas Santos
June 04, 2020
Tweet
Share
More Decks by Lucas Santos
See All by Lucas Santos
The Hitchhiker's Guide for an Amazing API with TypeScript
khaosdoctor
0
73
Escalando globalmente com TypeScript e JavaScript na Klarna
khaosdoctor
0
180
The future of JavaScript
khaosdoctor
0
47
TypeScript tips that could save your life
khaosdoctor
0
150
É hora de falar sobre Deno
khaosdoctor
0
63
JS Software testing for beginners
khaosdoctor
0
53
Ambientes dinâmicos com GitHub Actions
khaosdoctor
0
33
The Dark Side of JavaScript
khaosdoctor
0
64
Integrating Containers Into JavaScript
khaosdoctor
0
52
Other Decks in Programming
See All in Programming
Content Security Policy入門 セキュリティ設定と 違反レポートのはじめ方 / Introduction to Content Security Policy Getting Started with Security Configuration and Violation Reporting
uskey512
1
430
Sidekiqで実現する 長時間非同期処理の中断と再開 / Pausing and Resuming Long-Running Asynchronous Jobs with Sidekiq
hypermkt
6
2.7k
Dev ContainersとGitHub Codespacesの素敵な関係
ymd65536
1
130
Boost Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
870
現場で役立つモデリング 超入門
masuda220
PRO
13
2.9k
LLM生成文章の精度評価自動化とプロンプトチューニングの効率化について
layerx
PRO
2
140
シールドクラスをはじめよう / Getting Started with Sealed Classes
mackey0225
3
400
Golang と Erlang
taiyow
8
1.9k
CPython 인터프리터 구조 파헤치기 - PyCon Korea 24
kennethanceyer
0
250
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
210
讓數據說話:用 Python、Prometheus 和 Grafana 講故事
eddie
0
350
ピラミッド、アイスクリームコーン、SMURF: 自動テストの最適バランスを求めて / Pyramid Ice-Cream-Cone and SMURF
twada
PRO
9
1k
Featured
See All Featured
Gamification - CAS2011
davidbonilla
80
5k
How to Think Like a Performance Engineer
csswizardry
19
1.1k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
504
140k
Become a Pro
speakerdeck
PRO
24
5k
How to Ace a Technical Interview
jacobian
275
23k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Code Reviewing Like a Champion
maltzj
519
39k
A better future with KSS
kneath
238
17k
Raft: Consensus for Rubyists
vanstee
136
6.6k
YesSQL, Process and Tooling at Scale
rocio
167
14k
Teambox: Starting and Learning
jrom
132
8.7k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Transcript
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