Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
AIコーディングエージェント(skywork)
kondai24
0
100
Integrating WordPress and Symfony
alexandresalome
0
120
Micro Frontendsで築いた 共通基盤と運用の試行錯誤 / Building a Shared Platform with Micro Frontends: Operational Learnings
kyntk
1
1.9k
AIコードレビューがチームの"文脈"を 読めるようになるまで
marutaku
0
310
開発に寄りそう自動テストの実現
goyoki
1
250
tparseでgo testの出力を見やすくする
utgwkk
1
130
レイトレZ世代に捧ぐ、今からレイトレを始めるための小径
ichi_raven
0
490
20251127_ぼっちのための懇親会対策会議
kokamoto01_metaps
2
400
目的で駆動する、AI時代のアーキテクチャ設計 / purpose-driven-architecture
minodriven
11
3.9k
エディターってAIで操作できるんだぜ
kis9a
0
640
connect-python: convenient protobuf RPC for Python
anuraaga
0
350
All(?) About Point Sets
hole
0
260
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
73
11k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Java REST API Framework Comparison - PWX 2021
mraible
34
9k
The Language of Interfaces
destraynor
162
25k
Building Adaptive Systems
keathley
44
2.9k
Leading Effective Engineering Teams in the AI Era
addyosmani
8
1.2k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Large-scale JavaScript Application Architecture
addyosmani
514
110k
The Pragmatic Product Professional
lauravandoore
37
7k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.6k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
15k
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!