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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
Event Storming
hschwentner
3
1.3k
手戻りゼロ? Spec Driven Developmentとは@KAG AI week
tmhirai
1
140
Geminiの機能を調べ尽くしてみた
naruyoshimi
0
190
日本だけで解禁されているアプリ起動の方法
ryunakayama
0
360
CDIの誤解しがちな仕様とその対処TIPS
futokiyo
0
160
Claude Code の Skill で複雑な既存仕様をすっきり整理しよう
yuichirokato
1
260
クライアントワークでSREをするということ。あるいは事業会社におけるSREと同じこと・違うこと
nnaka2992
1
290
メタプログラミングで実現する「コードを仕様にする」仕組み/nikkei-tech-talk43
nikkei_engineer_recruiting
0
150
AHC061解説
shun_pi
0
290
RubyとGoでゼロから作る証券システム: 高信頼性が求められるシステムのコードの外側にある設計と運用のリアル
free_world21
0
170
atmaCup #23でAIコーディングを活用した話
ml_bear
4
720
エージェント開発初心者の僕がエージェントを作った話と今後やりたいこと
thasu0123
0
230
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
528
40k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
110
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.1k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.9k
A designer walks into a library…
pauljervisheath
210
24k
Six Lessons from altMBA
skipperchong
29
4.2k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
270
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
200
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
60
42k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
380
Building Adaptive Systems
keathley
44
2.9k
[SF Ruby Conf 2025] Rails X
palkan
2
800
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!