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
81
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
94
Asynchronous JS with Promise (+ Workshop)
makara
0
84
Asynchronous JS with Promise
makara
2
150
Other Decks in Programming
See All in Programming
20260228_JAWS_Beginner_Kansai
takuyay0ne
5
480
ロボットのための工場に灯りは要らない
watany
10
2.5k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
120
GC言語のWasm化とComponent Modelサポートの実践と課題 - Scalaの場合
tanishiking
0
110
クライアントワークでSREをするということ。あるいは事業会社におけるSREと同じこと・違うこと
nnaka2992
1
330
エラーログのマスキングの仕組みづくりに役立ったASTの話
kumoichi
0
170
New in Go 1.26 Implementing go fix in product development
sunecosuri
0
420
go directiveを最新にしすぎないで欲しい話──あるいは、Go 1.26からgo mod initで作られるgo directiveの値が変わる話 / Go 1.26 リリースパーティ
arthur1
2
530
nuget-server - あなたが必要だったNuGetサーバー
kekyo
PRO
0
230
PostgreSQL を使った快適な go test 環境を求めて
otakakot
0
530
Windows on Ryzen and I
seosoft
0
250
守る「だけ」の優しいEMを抜けて、 事業とチームを両方見る視点を身につけた話
maroon8021
3
720
Featured
See All Featured
Designing for Timeless Needs
cassininazir
0
160
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.1k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
89
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.2k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.8k
Docker and Python
trallard
47
3.8k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
140
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.1k
Embracing the Ebb and Flow
colly
88
5k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
480
Un-Boring Meetings
codingconduct
0
220
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.7k
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!