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
Code Reuse in Node.js (the short version)
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Makara Wang
April 20, 2013
Programming
0
81
Code Reuse in Node.js (the short version)
Makara Wang
April 20, 2013
Tweet
Share
More Decks by Makara Wang
See All by Makara Wang
Loose Coupling with Message Queue / Bus (the short version)
makara
1
94
Asynchronous JS with Promise (+ Workshop)
makara
0
84
Asynchronous JS with Promise
makara
2
150
Other Decks in Programming
See All in Programming
2026年 エンジニアリング自己学習法
yumechi
0
140
AIエージェントのキホンから学ぶ「エージェンティックコーディング」実践入門
masahiro_nishimi
5
460
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
240
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
220
15年続くIoTサービスのSREエンジニアが挑む分散トレーシング導入
melonps
2
200
Patterns of Patterns
denyspoltorak
0
1.4k
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
430
HTTPプロトコル正しく理解していますか? 〜かわいい猫と共に学ぼう。ฅ^•ω•^ฅ ニャ〜
hekuchan
2
690
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
1k
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
460
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
730
CSC307 Lecture 06
javiergs
PRO
0
690
Featured
See All Featured
Paper Plane
katiecoart
PRO
0
46k
How to make the Groovebox
asonas
2
1.9k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
180
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
310
Heart Work Chapter 1 - Part 1
lfama
PRO
5
35k
Music & Morning Musume
bryan
47
7.1k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
910
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.6k
The SEO Collaboration Effect
kristinabergwall1
0
350
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
1.9k
Done Done
chrislema
186
16k
Transcript
Code Reuse in Node.js (the short version) ⺩王浩宇 Makara Wang
[email protected]
2013.04.20
Assuming you know... JS & Node.js Prototype “this”
Common ways... Function + Arguments Good for: everything, promise, ...
Common ways... Prototype + Class Good for: modeling... ...or you
really care about performance ...or you want the long prototype chain
Common ways... Function Copy this[key] = that[key]; Good for: simpler
syntax, better syntax, ...
My favorite Function Copy ...with “Object.defineProperties()” Because it’s Node.js (not
a broken browser)
Implementations https://github.com/medikoo/es5-ext require('es5-ext/lib/Object/extend-properties'); https://github.com/devo-ps/carcass carcass.mixable(obj);
(Personal) Notes Use “this” Return “this” Reduce arguments Avoid “bind()”
...
Thanks!