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
Makara Wang
April 20, 2013
Programming
82
0
Share
Code Reuse in Node.js (the short version)
Makara Wang
April 20, 2013
More Decks by Makara Wang
See All by Makara Wang
Loose Coupling with Message Queue / Bus (the short version)
makara
1
97
Asynchronous JS with Promise (+ Workshop)
makara
0
91
Asynchronous JS with Promise
makara
2
150
Other Decks in Programming
See All in Programming
How We Benchmarked Quarkus: Patterns and anti-patterns
hollycummins
1
180
Vibe NLP for Applied NLP
inesmontani
PRO
0
600
My daily life on Ruby
a_matsuda
3
180
WebAssembly を読み込むベストプラクティス 2026年春版 / Best Practices for Loading WebAssembly (Spring 2026)
petamoriken
5
1.1k
Cache-moi si tu peux : patterns et pièges du cache en production - Devoxx France 2026 - Conférence
slecache
0
330
PHPer、Cloudflare に引っ越す
suguruooki
1
140
KMP × Kotlin 2.3 - How Android Got Slower While iOS Builds Improved by 47%
rio432
0
130
Agent Skills を社内で育てる仕組み作り
jackchuka
1
1.4k
いつか誰かが、と思っていた フロントエンド刷新5年間の実践知
kiichisugihara
1
250
実用!Hono RPC2026
yodaka
2
300
ソースコード→AST→オペコード、の旅を覗いてみる
o0h
PRO
1
120
Programming with a DJ Controller — not vibe coding
m_seki
3
780
Featured
See All Featured
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
350
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
140
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.3k
Bash Introduction
62gerente
615
210k
The Cult of Friendly URLs
andyhume
79
6.9k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.7k
Embracing the Ebb and Flow
colly
88
5k
Fireside Chat
paigeccino
42
3.9k
Building Adaptive Systems
keathley
44
3k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
The Limits of Empathy - UXLibs8
cassininazir
1
320
Odyssey Design
rkendrick25
PRO
2
610
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!