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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Makara Wang
April 20, 2013
Programming
85
0
Share
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
94
Asynchronous JS with Promise
makara
2
160
Other Decks in Programming
See All in Programming
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
430
密結合なバックエンドから TypeScript のコードを生成する
kemuridama
1
400
TSKaigi2026-静的解析への投資がAI時代のコード品質を支える ── カスタムESLintルールの設計と運用
hayatokudou
7
1.3k
Copilot CLI の継戦能力を高める コンテキスト管理
nozomutu
1
1.1k
TypeScriptだけでAIエージェントを作る フロント・エージェント・インフラのフルスタック実践
har1101
6
1.2k
Why Laravel apps break—Mastering the fundamentals to keep them maintainable
kentaroutakeda
1
330
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
2.4k
Composerを使ったサプライチェーン攻撃の様子を眺めてみる #phpstudy
o0h
PRO
2
200
サーバーレスで作る、動画データ管理基盤
oyasumipants
0
320
運用エージェントは "作る" から "育てる" へ - 記憶と自己進化の3層設計パターン / self-evolving-agents-three-layer-agent-design
gawa
12
3.3k
初めてのRubyKaigiはこう見えた
jellyfish700
0
380
GitHub Copilot CLIのいいところ
htkym
2
1.2k
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
432
67k
How to Think Like a Performance Engineer
csswizardry
28
2.6k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
320
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.4k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
580
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
210
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
22k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
150
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
350
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
118
120k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
720
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!