JS LIBRARIES
How to & How not to
Maël Nison, @arcanis
DEPENDENCY MANAGEMENT
- Require.js (Almond ?)
- Browserify
- CommonJS-everywhere
- Cat *.js > output.js
- No dependencies !
CONCEPTION
- Could worth a talk by itself
- Where does the user expects to find components ?
- Always consider the Demeter Law
LIBRARY API
- "Is it pretty" is a bad question
- "Is it flexible enough" is a good one
- Will your users understand ?
- Don't assume anything
MAGIC FEATURES
- Usually nice, and always fun to code ... but beware
- Two kind of magic : implementation details and Waza
Some no-no :
- Checking callback argument count
- Defining getters with side-effects
- ... Anything which cannot be deduced
CODING STYLE
- More important that you could think
- The best JS documentation is the source code
- You no longer write for your eyes
- Be consistent although flexible : readability comes first
Take it with
a pinch of salt !
(also, my new side-project)
![](https://github-camo.global.ssl.fastly.net/0170b5ff7cd0c80375cc8f16b6a578fd075912c8/687474703a2f2f617263616e69732e6769746875622e696f2f566972742e6a732f646f63756d656e74732f6173736574732f6c6f676f2d3130302e706e67)