Conquering complexity: refactoring JavaScript projects
summary
Claims that cognitive complexity (introduced 2016) predicts how hard code is to hold in the head better than cyclomatic metrics, and shows real results: open‑source scans find functions up to ~100–120, a demo reveal-confetti function is ~90 lines and scores 16. Recommends tooling (SonarCloud and SonarLint, eslint-plugin-sonarjs), strict tests before refactoring, and concrete refactor moves — invert conditions/early return, collapse adjacent conditionals, extract helpers, use optional chaining and nullish assignment — applied without changing behavior.
AI-written summary · about
chapters (8)
- 0:00Introduction
- 1:06Code complexity explained
- 3:56Measuring complexity metrics
- 11:15Finding complex functions
- 15:28Refactoring effectively
- 20:43Reducing cognitive complexity
- 33:14Summary and tools
- 38:06Q&A
related talks
40mConquering Complexity: Refactoring JavaScript Projects
58mImproving Quality of JavaScript Code
40mRefactoring large JavaScript codebases
58mImproving the Quality of JavaScript Code
35mThe top 5 JavaScript issues in all our codebases
47mThe top 5 JavaScript issues in all our codebases
25mThe Top 5 JavaScript Issues in All Our Codebases
40mHow To (Semi-)Automate JavaScript Refactoring
