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
74
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
89
Asynchronous JS with Promise (+ Workshop)
makara
0
77
Asynchronous JS with Promise
makara
2
150
Other Decks in Programming
See All in Programming
Spatial Rendering for Apple Vision Pro
warrenm
0
120
MCP with Cloudflare Workers
yusukebe
2
220
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
技術的負債と向き合うカイゼン活動を1年続けて分かった "持続可能" なプロダクト開発
yuichiro_serita
0
120
テストコード文化を0から作り、変化し続けた組織
kazatohiei
2
1.5k
歴史と現在から考えるスケーラブルなソフトウェア開発のプラクティス
i10416
0
110
なまけものオバケたち -PHP 8.4 に入った新機能の紹介-
tanakahisateru
1
120
rails stats で紐解く ANDPAD のイマを支える技術たち
andpad
1
300
生成AIでGitHubソースコード取得して仕様書を作成
shukob
0
500
週次リリースを実現するための グローバルアプリ開発
tera_ny
1
110
Go の GC の不得意な部分を克服したい
taiyow
3
810
[JAWS-UG横浜 #76] イケてるアップデートを宇宙いち早く紹介するよ!
maroon1st
0
500
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
222
9k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
900
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
We Have a Design System, Now What?
morganepeng
51
7.3k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Fireside Chat
paigeccino
34
3.1k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
520
Building an army of robots
kneath
302
44k
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!