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
0
80
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
92
Asynchronous JS with Promise (+ Workshop)
makara
0
82
Asynchronous JS with Promise
makara
2
150
Other Decks in Programming
See All in Programming
Google I/O recap web編 大分Web祭り2025
kponda
0
2.9k
Introducing ReActionView: A new ActionView-compatible ERB Engine @ Rails World 2025, Amsterdam
marcoroth
0
310
Updates on MLS on Ruby (and maybe more)
sylph01
1
170
go test -json そして testing.T.Attr / Kyoto.go #63
utgwkk
2
220
フロントエンドのmonorepo化と責務分離のリアーキテクト
kajitack
2
160
Kiroの仕様駆動開発から見えてきたAIコーディングとの正しい付き合い方
clshinji
1
190
Claude Codeで挑むOSSコントリビュート
eycjur
0
190
機能追加とリーダー業務の類似性
rinchoku
0
440
AWS発のAIエディタKiroを使ってみた
iriikeita
1
140
オープンセミナー2025@広島LT技術ブログを続けるには
satoshi256kbyte
0
150
The state patternの実践 個人開発で培ったpractice集
miyanokomiya
0
160
奥深くて厄介な「改行」と仲良くなる20分
oguemon
1
280
Featured
See All Featured
Code Review Best Practice
trishagee
70
19k
Practical Orchestrator
shlominoach
190
11k
YesSQL, Process and Tooling at Scale
rocio
173
14k
GitHub's CSS Performance
jonrohan
1032
460k
The Straight Up "How To Draw Better" Workshop
denniskardys
236
140k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
Mobile First: as difficult as doing things right
swwweet
224
9.9k
Writing Fast Ruby
sferik
628
62k
Agile that works and the tools we love
rasmusluckow
330
21k
Reflections from 52 weeks, 52 projects
jeffersonlam
351
21k
A Tale of Four Properties
chriscoyier
160
23k
The Art of Programming - Codeland 2020
erikaheidi
55
13k
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!