SlideShare a Scribd company logo
Managing JavaScript Complexity in Teams - Fluent
JARROD OVERSON
MANAGING
JAVASCRIPT
@jsoversonCOMPLEXITY
WHO IS
RIOT
WE MAKE A GAME
Managing JavaScript Complexity in Teams - Fluent
A GAME THAT GOT HUGE
Managing JavaScript Complexity in Teams - Fluent
BUT I JUST
MAKE WEB
STUFF
THE WEB IS
AWESOME
BUT, WE NEED TO TALK.
PEAK OF INFLATED EXPECTATIONS
TROUGH OF DISILLUSIONMENT
HTML5
MOBILE WEB APPS
PLATEAU OF REALITY
The Web
Platform
2008 2009 2010 2011 2012 2013 2014 NOW WE CAN MOVE ON
STEP TWO
STEP ONE
STEP THREE
HONESTY
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
THE TALENT POOL IS NUTS.2.
COMING TO TERMS
Web Platform Engineers
jQuery Experts
Made a menu fade in once
async wat?
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.
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.
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.
WHY ARE WE EVEN HERE?
JAVASCRIPT

WON
AND THIS ISN’T EVEN ITS FINAL FORM
STEP ONE
STEP THREE
ACCEPTANCE
STEP TWO
RESPECT
YOUR JAVASCRIPT
‣ 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
RESPECT
THE COMMUNITY
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
VIOLATIONS BEGET VIOLATIONS
ALLOW 1 & ALLOW 1,000
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?
KNOW YOUR OPTION’S OPTIONS
BE AGGRESSIVE. YOUR FEELINGS WILL GET HURT.
SMART DEVIATION IS OK AND EXPECTED
!
!
function fn(param) {
/*jshint eqeqeq:false*/
!
if (param == 42) return;
!
}
SET NUMERIC LIMITS
"maxparams" : 4
"maxdepth" : 4
"maxstatements" : 20
"maxlen" : 100
"maxcomplexity" : 7
WHAT IS
COMPLEXITY?
CYCLOMATIC
TECHNICALLY
CYCLOMATIC COMPLEXITY
IS THE NUMBER OF PATHS
THROUGH YOUR CODE
PRACTICALLY
CYCLOMATIC COMPLEXITY
IS HOW HARD 

YOUR CODE IS TO TEST
COMPLEXITY : 1
!
function main(a) {
!
}
COMPLEXITY : 2
function main(a) {
if (a > 5) {
}
}
COMPLEXITY : ?
function main(a) {
if (a > 5) {
!
} else {
!
}
}
COMPLEXITY : 3
function main(a) {
if (a > 10) {
!
} else if(a > 5) {
!
}
}
COMPLEXITY : ?
function main(a) {
if (a > 5) {
if (a > 10) {
!
}
}
}
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) {
}
}
}
I KNOW WHAT YOU’RE THINKING
I’M
GOING TO MAKE THE
MOST AMAZING .JSHINTRC
EVER
BUT IT’S NOT THAT EASY
STEP TWO
STEP ONE
PERSEVERANCE
STEP THREE
VISUALIZE YOUR GOAL
VISUALIZE YOUR CODE
PLATO
Your friendly, neighborhood
philosopher
PLATOJS.ORG
YOUR GOAL
THE PATH
FILES PASSING IDEAL SETTINGS
THE PATH
FILES IN NEED OF LARGER REFACTOR
THE PATH
QUICK WINS
OTHER
METRICS
HALSTEAD METRICS
CODE COVERAGE
MAINTAINABILITY
LINES OF CODE
MAINTAINABILITY?
fn(averageEffort, averageComplexity, averageLines);
fn(difficulty, volume)
fn(length, vocabulary)
fn(uniqueOperators, totalOperands, uniqueOperands)
fn(uniqueOperators, uniqueOperands)
fn(totalOperators, totalOperands)
MAURICE HALSTEAD
HALSTEAD METRICS
PHIL BOOTH ARIYA HIDAYATTHOMAS MCCABE
CYCLOMATIC COMPLEXITY COMPLEXITY ANALYSIS JS STATIC ANALYSIS
WHO TO BLAME
THE UNEXAMINED CODE IS
NOT WORTH RELEASING
“
”
- SOCRATES
CODE IS NOT JUST LOGIC.
CODE IS AN API.
TREAT IT LIKE ONE.
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
JARROD OVERSON
MANAGING
JAVASCRIPT
@jsoversonCOMPLEXITY
Office hours @ 2:10pm

More Related Content

KEY
CoffeeScript: JavaScript, but Better!
TXT
PDF
Integrating Browserify with Sprockets
PDF
Building Isomorphic Apps (JSConf.Asia 2014)
PDF
General Assembly Workshop: Advanced JavaScript
PDF
Isomorphic JavaScript: #DevBeat Master Class
PDF
JSConf US 2014: Building Isomorphic Apps
PDF
In Pursuit of the Holy Grail: Building Isomorphic JavaScript Apps
CoffeeScript: JavaScript, but Better!
Integrating Browserify with Sprockets
Building Isomorphic Apps (JSConf.Asia 2014)
General Assembly Workshop: Advanced JavaScript
Isomorphic JavaScript: #DevBeat Master Class
JSConf US 2014: Building Isomorphic Apps
In Pursuit of the Holy Grail: Building Isomorphic JavaScript Apps

Similar to Managing JavaScript Complexity in Teams - Fluent (20)

PDF
Managing JavaScript Complexity
PDF
JSHint: Learning JavaScript the Hard Way
PDF
Idiot proofing your code
PDF
Refactoring JavaScript turning bad code into good code First Edition Burchard
PDF
Maintainability SFJS Sept 4 2014
PDF
Leveling Up at JavaScript
PDF
Quo vadis, JavaScript? Devday.pl keynote
PDF
Introduction to web programming with JavaScript
PDF
Choosing Javascript Libraries to Adopt for Development
PDF
Download full ebook of (Ebook) learning javascript 3e by kan instant download...
PDF
JavaScript Like It’s 2013
PDF
Build a Game with JavaScript - Pasadena July
PDF
Javascript The Definitive Guideactivate Your Web Pages 6th Ed Flanagan
PDF
Breaking out of the endless callback look - #jsday Italy keynote
PDF
The state of JavaScript Linting - English version
PDF
Let’s learn how to use JavaScript responsibly and stay up-to-date.
PPTX
Front-end development introduction (JavaScript). Part 2
PDF
Intro to js september 19
PDF
Java script core
Managing JavaScript Complexity
JSHint: Learning JavaScript the Hard Way
Idiot proofing your code
Refactoring JavaScript turning bad code into good code First Edition Burchard
Maintainability SFJS Sept 4 2014
Leveling Up at JavaScript
Quo vadis, JavaScript? Devday.pl keynote
Introduction to web programming with JavaScript
Choosing Javascript Libraries to Adopt for Development
Download full ebook of (Ebook) learning javascript 3e by kan instant download...
JavaScript Like It’s 2013
Build a Game with JavaScript - Pasadena July
Javascript The Definitive Guideactivate Your Web Pages 6th Ed Flanagan
Breaking out of the endless callback look - #jsday Italy keynote
The state of JavaScript Linting - English version
Let’s learn how to use JavaScript responsibly and stay up-to-date.
Front-end development introduction (JavaScript). Part 2
Intro to js september 19
Java script core
Ad

More from Jarrod Overson (18)

PDF
Practical WebAssembly with Apex, wasmRS, and nanobus
PDF
AppSecCali - How Credential Stuffing is Evolving
PDF
How Credential Stuffing is Evolving - PasswordsCon 2019
PDF
JSconf JP - Analysis of an exploited npm package. Event-stream's role in a su...
PDF
Analysis of an OSS supply chain attack - How did 8 millions developers downlo...
PDF
Deepfakes - How they work and what it means for the future
PDF
The State of Credential Stuffing and the Future of Account Takeovers.
PDF
How to Reverse Engineer Web Applications
PDF
The life of breached data and the attack lifecycle
PDF
The Life of Breached Data & The Dark Side of Security
PDF
Shape Security @ WaffleJS October 16
PDF
Graphics Programming for Web Developers
PDF
The Dark Side of Security
PDF
JavaScript and the AST
PDF
ES2015 workflows
PDF
Riot on the web - Kenote @ QCon Sao Paulo 2014
PDF
Real World Web components
PDF
Continuous Delivery for the Web Platform
Practical WebAssembly with Apex, wasmRS, and nanobus
AppSecCali - How Credential Stuffing is Evolving
How Credential Stuffing is Evolving - PasswordsCon 2019
JSconf JP - Analysis of an exploited npm package. Event-stream's role in a su...
Analysis of an OSS supply chain attack - How did 8 millions developers downlo...
Deepfakes - How they work and what it means for the future
The State of Credential Stuffing and the Future of Account Takeovers.
How to Reverse Engineer Web Applications
The life of breached data and the attack lifecycle
The Life of Breached Data & The Dark Side of Security
Shape Security @ WaffleJS October 16
Graphics Programming for Web Developers
The Dark Side of Security
JavaScript and the AST
ES2015 workflows
Riot on the web - Kenote @ QCon Sao Paulo 2014
Real World Web components
Continuous Delivery for the Web Platform
Ad

Recently uploaded (20)

PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Spectroscopy.pptx food analysis technology
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Cloud computing and distributed systems.
PPTX
Big Data Technologies - Introduction.pptx
PPT
Teaching material agriculture food technology
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
Network Security Unit 5.pdf for BCA BBA.
Programs and apps: productivity, graphics, security and other tools
NewMind AI Weekly Chronicles - August'25 Week I
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Per capita expenditure prediction using model stacking based on satellite ima...
Review of recent advances in non-invasive hemoglobin estimation
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
MIND Revenue Release Quarter 2 2025 Press Release
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Encapsulation theory and applications.pdf
Empathic Computing: Creating Shared Understanding
The Rise and Fall of 3GPP – Time for a Sabbatical?
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Spectroscopy.pptx food analysis technology
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Cloud computing and distributed systems.
Big Data Technologies - Introduction.pptx
Teaching material agriculture food technology
“AI and Expert System Decision Support & Business Intelligence Systems”

Managing JavaScript Complexity in Teams - Fluent