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
止められない医療アプリ、そっと Swift 6 へ
medley
1
140
ソフトウェア設計の実践的な考え方
masuda220
PRO
4
550
XP, Testing and ninja testing ZOZ5
m_seki
3
590
アメ車でサンノゼを走ってきたよ!
s_shimotori
0
220
クラシルを支える技術と組織
rakutek
0
200
いま中途半端なSwift 6対応をするより、Default ActorやApproachable Concurrencyを有効にしてからでいいんじゃない?
yimajo
2
400
monorepo の Go テストをはやくした〜い!~最小の依存解決への道のり~ / faster-testing-of-monorepos
convto
2
460
技術的負債の正体を知って向き合う / Facing Technical Debt
irof
0
150
エンジニアとして高みを目指す、 利益を生み出す設計の考え方 / design-for-profit
minodriven
24
12k
Cursorハンズオン実践!
eltociear
2
870
チームの境界をブチ抜いていけ
tokai235
0
150
Swift Concurrency - 状態監視の罠
objectiveaudio
2
510
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
45
7.7k
Making Projects Easy
brettharned
119
6.4k
Building Adaptive Systems
keathley
43
2.8k
Site-Speed That Sticks
csswizardry
11
890
How to Ace a Technical Interview
jacobian
280
24k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.1k
jQuery: Nuts, Bolts and Bling
dougneiner
64
7.9k
How to train your dragon (web standard)
notwaldorf
96
6.3k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
358
30k
[RailsConf 2023] Rails as a piece of cake
palkan
57
5.9k
Git: the NoSQL Database
bkeepers
PRO
431
66k
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!