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
明示と暗黙 ー PHPとGoの インターフェイスの違いを知る
shimabox
2
510
ruby.wasmで多人数リアルタイム通信ゲームを作ろう
lnit
3
490
AI駆動のマルチエージェントによる業務フロー自動化の設計と実践
h_okkah
0
150
ソフトウェア品質を数字で捉える技術。事業成長を支えるシステム品質の マネジメント
takuya542
1
13k
Porting a visionOS App to Android XR
akkeylab
0
470
Blazing Fast UI Development with Compose Hot Reload (droidcon New York 2025)
zsmb
1
290
iOS 26にアップデートすると実機でのHot Reloadができない?
umigishiaoi
0
130
スタートアップの急成長を支えるプラットフォームエンジニアリングと組織戦略
sutochin26
1
5.8k
PipeCDのプラグイン化で目指すところ
warashi
1
280
Flutterで備える!Accessibility Nutrition Labels完全ガイド
yuukiw00w
0
160
イベントストーミング図からコードへの変換手順 / Procedure for Converting Event Storming Diagrams to Code
nrslib
2
820
技術同人誌をMCP Serverにしてみた
74th
1
650
Featured
See All Featured
The Cult of Friendly URLs
andyhume
79
6.5k
BBQ
matthewcrist
89
9.7k
A better future with KSS
kneath
238
17k
Bash Introduction
62gerente
613
210k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
18
970
Adopting Sorbet at Scale
ufuk
77
9.5k
Rails Girls Zürich Keynote
gr2m
95
14k
We Have a Design System, Now What?
morganepeng
53
7.7k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
How to Ace a Technical Interview
jacobian
278
23k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
2.9k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
60k
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!