ENTERPRISE NODE
CODE QUALITY
ABOUT ME
Tech Lead @ MLS
Medium: @kurtiskemple
Twitter: @kurtiskemple
GitHub: @kkemple
3
REPO FOR THIS WEBINAR
KKEMPLE/AWESOME-ENTERPRISE-WEB-SERVICE
WHY IS CODE QUALITY IMPORTANT?
BENEFITS
• Prevents Entropy
• Improves Velocity
• Increases Developer Morale
WHAT DEFINES QUALITY CODE?
THE THREE Cs OF CODE QUALITY
• Clarity
• Complexity
• Coverage
CLARITY
WHAT DOES CLARITY MEAN?
• Code Is Formatted Well
• Code Is Cohesive (Things that belong together are together)
• Variable and Function Names Give Context
COMPLEXITY
“Cyclomatic complexity is a software metric (measurement),
used to indicate the complexity of a program. It is a
quantitative measure of the number of linearly independent
paths through a program's source code.”
http://blog.codeclimate.com/blog/2013/12/12/the-roots-of-
static-analysis/
WHY IS MEASURING COMPLEXITY
IMPORTANT?
• It identifies tightly coupled sections of your application
• It identifies methods that might not be clear due to excessive
logic
• It helps identify trends (developer fatigue, tech-debt, etc…)
COVERAGE
COVERAGE !== QUALITY
It’s important to note that a high coverage score is not
equivalent to a quality test suite. However, it does show
parts of your application that have no tests.
WHY IS COVERAGE IMPORTANT?
• It identifies areas of the application that are not tested
• It identifies trends in test/code addition ratios
• It helps instill confidence in the application
SETTING STANDARDS
BIKESHEDDING
or Parkinson’s Law of Triviality…
https://en.wikipedia.org/wiki/Law_of_triviality
PICKING A STANDARD
ENFORCING THE STANDARD
• Linting should be run during development (editor plugins,
watching files, etc)
• Linting should break your build when it fails!
• Broken builds should never be merged!
INTEGRATING STANDARDS INTO
YOUR WORKFLOW
CODE CLIMATE
HOUND CI
CODECOV
Q&A
• Enterprise Node.js - Code Quality
https://www.crowdcast.io/e/enterprise-node-1
• Enterprise Node.js - Code Discovery
https://www.crowdcast.io/e/enterprise-node-2
• Enterprise Node.js - Securing Your Environment
https://www.crowdcast.io/e/enterprise-node-3
• Enterprise Node.js - Deploying with Docker
https://www.crowdcast.io/e/enterprise-node-4
27
ENTERPRISE NODE.JS
JavaScript is replacing Java, Ruby, and .NET as the technology of choice for
companies that want to build enterprise software faster, and with fewer
resources. Learn about enterprise JavaScript applications at every level of the
stack. As well as how to secure, integrate, test, store, monitor, and deploy
them.
O’REILLY SOFTWARE ARCHITECTURE
CONFERENCE
Architecting For Enterprise in Node.js

Enterprise Node - Code Quality

  • 1.
  • 2.
    ABOUT ME Tech Lead@ MLS Medium: @kurtiskemple Twitter: @kurtiskemple GitHub: @kkemple
  • 3.
    3 REPO FOR THISWEBINAR KKEMPLE/AWESOME-ENTERPRISE-WEB-SERVICE
  • 4.
    WHY IS CODEQUALITY IMPORTANT?
  • 5.
    BENEFITS • Prevents Entropy •Improves Velocity • Increases Developer Morale
  • 6.
  • 7.
    THE THREE CsOF CODE QUALITY • Clarity • Complexity • Coverage
  • 8.
  • 10.
    WHAT DOES CLARITYMEAN? • Code Is Formatted Well • Code Is Cohesive (Things that belong together are together) • Variable and Function Names Give Context
  • 11.
  • 12.
    “Cyclomatic complexity isa software metric (measurement), used to indicate the complexity of a program. It is a quantitative measure of the number of linearly independent paths through a program's source code.”
  • 13.
  • 14.
    WHY IS MEASURINGCOMPLEXITY IMPORTANT? • It identifies tightly coupled sections of your application • It identifies methods that might not be clear due to excessive logic • It helps identify trends (developer fatigue, tech-debt, etc…)
  • 15.
  • 16.
    COVERAGE !== QUALITY It’simportant to note that a high coverage score is not equivalent to a quality test suite. However, it does show parts of your application that have no tests.
  • 17.
    WHY IS COVERAGEIMPORTANT? • It identifies areas of the application that are not tested • It identifies trends in test/code addition ratios • It helps instill confidence in the application
  • 18.
  • 19.
    BIKESHEDDING or Parkinson’s Lawof Triviality… https://en.wikipedia.org/wiki/Law_of_triviality
  • 20.
  • 21.
    ENFORCING THE STANDARD •Linting should be run during development (editor plugins, watching files, etc) • Linting should break your build when it fails! • Broken builds should never be merged!
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
    • Enterprise Node.js- Code Quality https://www.crowdcast.io/e/enterprise-node-1 • Enterprise Node.js - Code Discovery https://www.crowdcast.io/e/enterprise-node-2 • Enterprise Node.js - Securing Your Environment https://www.crowdcast.io/e/enterprise-node-3 • Enterprise Node.js - Deploying with Docker https://www.crowdcast.io/e/enterprise-node-4 27 ENTERPRISE NODE.JS
  • 28.
    JavaScript is replacingJava, Ruby, and .NET as the technology of choice for companies that want to build enterprise software faster, and with fewer resources. Learn about enterprise JavaScript applications at every level of the stack. As well as how to secure, integrate, test, store, monitor, and deploy them. O’REILLY SOFTWARE ARCHITECTURE CONFERENCE Architecting For Enterprise in Node.js