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
76
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
91
Asynchronous JS with Promise (+ Workshop)
makara
0
79
Asynchronous JS with Promise
makara
2
150
Other Decks in Programming
See All in Programming
法律の脱レガシーに学ぶフロントエンド刷新
oguemon
5
670
chibiccをCILに移植した結果 (NGK2025S版)
kekyo
PRO
0
200
Spring gRPC について / About Spring gRPC
mackey0225
0
200
チームリードになって変わったこと
isaka1022
0
160
Kubernetes History Inspector(KHI)を触ってみた
bells17
0
170
AWSマネコンに複数のアカウントで入れるようになりました
yuhta28
2
160
動作確認やテストで漏れがちな観点3選
starfish719
6
930
Pulsar2 を雰囲気で使ってみよう
anoken
0
200
Java Webフレームワークの現状 / java web framework at burikaigi
kishida
9
2.1k
ペアーズでの、Langfuseを中心とした評価ドリブンなリリースサイクルのご紹介
fukubaka0825
1
260
【PHP】破壊的バージョンアップと戦った話〜決断と説得
satoshi256kbyte
0
120
SRE、開発、QAが協業して挑んだリリースプロセス改革@SRE Kaigi 2025
nealle
3
3.8k
Featured
See All Featured
Speed Design
sergeychernyshev
25
760
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Bash Introduction
62gerente
610
210k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Statistics for Hackers
jakevdp
797
220k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
98
18k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
20
2.4k
A designer walks into a library…
pauljervisheath
205
24k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Product Roadmaps are Hard
iamctodd
PRO
50
11k
The World Runs on Bad Software
bkeepers
PRO
67
11k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
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!