13. DYNAMIC LANGUAGES ARE MESSY.1.
COMING TO TERMS
Combine the normal pitfalls with
!
• Immature IDEs and tooling
• Wildly variable module styles
• Best practices that vary monthly
• Similar yet vastly different ecosystems
14. THE TALENT POOL IS NUTS.2.
COMING TO TERMS
Web Platform Engineers
jQuery Experts
Made a menu fade in once
async wat?
15. PROGRESS IS STAGGERING.3.
COMING TO TERMS
It’s hard to keep up.
!
Everyone has an opinion.
!
The future doesn’t get here all at once.
16. REFACTORING JAVASCRIPT IS NOT EASY.4.
COMING TO TERMS
Callback hell is more than just deep nesting.
!
IDEs can’t help much yet.
!
Flexibility is more important here than anywhere.
17. THE WEB IS HARD!5.
COMING TO TERMS
Web applications are not solved.
!
Even the giants pivot and backtrack.
!
So many solutions just don’t exist yet.
23. ‣ Indentation style
‣ Line length
‣ Quote styles
‣ Naming conventions
‣ Curly brace placement
‣ Directory structure
‣ Everything
GET EVERYONE TOGETHER
ENFORCE
‣ Use community tools
‣ Grunt
‣ Gulp
‣ JSHint
‣ etc
‣ Warnings === errors
‣ Make it hard to be
wrong
DOCUMENT
‣ Treat docs as code
‣ Make it
‣ easy to find
‣ easy to read
‣ easy to update
‣ easy to discuss
‣ Use github!
AGREE
25. RESPECT
THE COMMUNITY
>90% use last comma
http://sideeffect.kr/popularconvention/#javascript
>80% indent with spaces
>55% use single quotes
https://github.com/Seravo/js-winning-style
https://github.com/rwaldron/idiomatic.js/
Research public style guides
27. KNOW YOUR OPTIONS
JSHINT
ESLINT
JSCS
Community-driven JSLint fork. High configurability.
JSHint alternative. High configurability.
Code style checker. Good complement to JSHint.
WHAT ABOUT JSLINT AND CLOSURE LINTER?
40. COMPLEXITY : 7
function main(a) {
if (a) {
} else if (a) {
}
!
if (other) { }
!
for (var i = 0; i < a; i++) {
if (i % 2) {
} else if (i % 3) {
}
}
}
41. I KNOW WHAT YOU’RE THINKING
I’M
GOING TO MAKE THE
MOST AMAZING .JSHINTRC
EVER
54. CODE IS NOT JUST LOGIC.
CODE IS AN API.
TREAT IT LIKE ONE.
55. Recap
PERSEVERANCE
The web has unique value,
it’s not a cheap alternative to native apps.
Embrace the web and JavaScript as your platform.
Create new tools. Automate & visualize everything.
ACCEPTANCE
HONESTY