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
89
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
100
Asynchronous JS with Promise (+ Workshop)
makara
0
96
Asynchronous JS with Promise
makara
2
160
Other Decks in Programming
See All in Programming
肥大化するレガシーコードに立ち向かうためのインターフェース分離と依存の逆転 / JJUG CCC 2026 Spring
hirokunimaeta
0
590
さぁV100、メモリをお食べ・・・
nilpe
0
150
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
380
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.7k
Agentic UI
manfredsteyer
PRO
0
180
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
550
ふつうのFeature Flag実践入門
irof
8
4.1k
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
270
DynamoDBには集計系のクエリがないけどなんとかしたい
musan
1
180
Honoでのサプライチェーン侵害対策 〜 3つのライブラリに学ぶ
yusukebe
7
1.4k
依存関係から依存物へ―Dependencyという言葉の歴史をひも解く
j_lee
0
130
技術的負債解消で開発者の未来を開く- AIの力でコード刷新
kmd2kmd
0
110
Featured
See All Featured
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
400
4 Signs Your Business is Dying
shpigford
187
22k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.5k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
440
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.5k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.5k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.5k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
310
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Everyday Curiosity
cassininazir
0
230
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!