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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
CSC307 Lecture 04
javiergs
PRO
0
660
izumin5210のプロポーザルのネタ探し #tskaigi_msup
izumin5210
1
120
CSC307 Lecture 08
javiergs
PRO
0
670
2026年 エンジニアリング自己学習法
yumechi
0
130
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
650
CSC307 Lecture 02
javiergs
PRO
1
780
OSSとなったswift-buildで Xcodeのビルドを差し替えられるため 自分でXcodeを直せる時代になっている ダイアモンド問題編
yimajo
3
620
Grafana:建立系統全知視角的捷徑
blueswen
0
330
[KNOTS 2026登壇資料]AIで拡張‧交差する プロダクト開発のプロセス および携わるメンバーの役割
hisatake
0
280
IFSによる形状設計/デモシーンの魅力 @ 慶應大学SFC
gam0022
1
300
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
570
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
270
Featured
See All Featured
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
580
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.3k
Designing for humans not robots
tammielis
254
26k
Testing 201, or: Great Expectations
jmmastey
46
8k
Art, The Web, and Tiny UX
lynnandtonic
304
21k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
66
Prompt Engineering for Job Search
mfonobong
0
160
Documentation Writing (for coders)
carmenintech
77
5.3k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
110
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
82
Mobile First: as difficult as doing things right
swwweet
225
10k
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!