SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Downloaden Sie, um offline zu lesen
9 anti-patterns 
for node.js teams 
Jeff Harrell 
@juxtajeff
Node first went live on paypal.com in 2013. 
Since: 
• 35 apps live (marketing, signup, 
account, payments, etc). 
• 400 new JavaScript engineers 
• 500,000 npm installs per day (internally) 
Made a good deal of mistakes to learn from
Anti-pattern #1 
Baggage from your previous technology
• "Node doesn't support x. It won’t work" 
• “How do I deal with npm version conflicts?” 
• “Can’t let the app restart. It takes too long”
Leave your baggage behind." 
! 
Except when you’re flying
Anti-pattern #2 
Monolithic applications
• Use an internal npm instance 
• Publish modules vs. embedding functionality 
• Don’t overload modules – compose them 
Prefer different user, credit card and bank modules 
Avoid a single “shared” module
Build with many blocks, not one."
Anti-pattern #3 
Googling “How to do x in JavaScript”
• jQuery results dominate search engines 
• Understand ES5 
• Be aware of what’s coming in ES6
Learn JavaScript before diving in." 
!
Anti-pattern #4 
Handling errors
• Use an Error object, not a string 
• Throwing is for programmer errors 
• Restart on uncaught exception vs ignoring it
Error cases are hard." 
! 
Make sure to deal with them
Anti-pattern #5 
Wrapping everything in promises
• Use for the right reasons (not throw or waterfall) 
• Modules should expose callback interfaces 
• Use promises sparingly in hot code 
27% of CPU time spent in promise execution
Callbacks." 
! 
Seriously
Anti-pattern #6 
Git URLs in your package.json
• Git URLs don’t fully leverage semver 
• Weird caching issues 
• Unstable state (akin to force overwriting in npm)
Publish to npm." 
! 
Set it up internally and use it
Anti-pattern #7 
Sloppy async code
• Understand control flow patterns 
• Don’t create crazy waterfalls 
Hoist functions 
Use promises (appropriately) 
Use async 
• Callback with code afterwards, but no return 
if (true) { 
callback(); 
} 
fallback();
Use good async patterns." 
! 
Queue funny mis-ordered async sentence
Anti-pattern #8 
Having node do everything
• SSL termination should be done by nginx 
• Heavy encryption is not for node 
• Don’t bind directly to port 80/443 
“How do I enable gzip?” 
“How do I add an SSL cert to my app?”
Best tool, meet job." 
!
Anti-pattern #9 
Ignoring the node ecosystem
• npm has a wealth of pre-written code 
• Get updates from community, e.g. Node Security 
• Conferences like this
Embrace your new community." 
! 
Warning: May contain drama
Thanks!" 
! 
Q&A is over drinks later!
Photo Credits 
1. https://www.flickr.com/photos/11334694@N00/268023465/ 
2. https://www.flickr.com/photos/14125773@N00/14205159881/ 
3. https://www.flickr.com/photos/60364452@N00/3921008904/ 
4. https://www.flickr.com/photos/83099438@N00/5902730038 
5. https://www.flickr.com/photos/82402200@N00/523497824/ 
6. https://www.flickr.com/photos/48553010@N00/113694992/ 
7. https://www.flickr.com/photos/46889122@N03/4304137088/ 
8. https://www.flickr.com/photos/39039882@N00/5189290606/ 
9. https://www.flickr.com/photos/43145783@N00/1852428153/

Weitere ähnliche Inhalte

Was ist angesagt?

Server-Side JavaScript with Nashorn
Server-Side JavaScript with NashornServer-Side JavaScript with Nashorn
Server-Side JavaScript with NashornDaniel Woods
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsRob O'Doherty
 
Mobile Library Development - stuck between a pod and a jar file - Zan Markan ...
Mobile Library Development - stuck between a pod and a jar file - Zan Markan ...Mobile Library Development - stuck between a pod and a jar file - Zan Markan ...
Mobile Library Development - stuck between a pod and a jar file - Zan Markan ...Codemotion
 
Zepto and the rise of the JavaScript Micro-Frameworks
Zepto and the rise of the JavaScript Micro-FrameworksZepto and the rise of the JavaScript Micro-Frameworks
Zepto and the rise of the JavaScript Micro-FrameworksThomas Fuchs
 
React native in the wild @ Codemotion 2016 in Rome
React native in the wild @ Codemotion 2016 in RomeReact native in the wild @ Codemotion 2016 in Rome
React native in the wild @ Codemotion 2016 in RomeAlessandro Nadalin
 
Building web apps with node.js, socket.io, knockout.js and zombie.js - Codemo...
Building web apps with node.js, socket.io, knockout.js and zombie.js - Codemo...Building web apps with node.js, socket.io, knockout.js and zombie.js - Codemo...
Building web apps with node.js, socket.io, knockout.js and zombie.js - Codemo...Ivan Loire
 
Complete MVC on NodeJS
Complete MVC on NodeJSComplete MVC on NodeJS
Complete MVC on NodeJSHüseyin BABAL
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentPHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentIrfan Maulana
 
Webinar - Matteo Manchi: Dal web al nativo: Introduzione a React Native
Webinar - Matteo Manchi: Dal web al nativo: Introduzione a React Native Webinar - Matteo Manchi: Dal web al nativo: Introduzione a React Native
Webinar - Matteo Manchi: Dal web al nativo: Introduzione a React Native Codemotion
 
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialOSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialTom Croucher
 
Queue Everything and Please Everyone
Queue Everything and Please EveryoneQueue Everything and Please Everyone
Queue Everything and Please EveryoneVaidik Kapoor
 
Introduction to NodeJS
Introduction to NodeJSIntroduction to NodeJS
Introduction to NodeJSZahid Mahir
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016Matt Raible
 
Saving Time By Testing With Jest
Saving Time By Testing With JestSaving Time By Testing With Jest
Saving Time By Testing With JestBen McCormick
 
Seattlerb why jruby
Seattlerb why jrubySeattlerb why jruby
Seattlerb why jrubysnacktime
 
Das kannste schon so machen
Das kannste schon so machenDas kannste schon so machen
Das kannste schon so machenAndré Goliath
 

Was ist angesagt? (20)

Server-Side JavaScript with Nashorn
Server-Side JavaScript with NashornServer-Side JavaScript with Nashorn
Server-Side JavaScript with Nashorn
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Mobile Library Development - stuck between a pod and a jar file - Zan Markan ...
Mobile Library Development - stuck between a pod and a jar file - Zan Markan ...Mobile Library Development - stuck between a pod and a jar file - Zan Markan ...
Mobile Library Development - stuck between a pod and a jar file - Zan Markan ...
 
Zepto and the rise of the JavaScript Micro-Frameworks
Zepto and the rise of the JavaScript Micro-FrameworksZepto and the rise of the JavaScript Micro-Frameworks
Zepto and the rise of the JavaScript Micro-Frameworks
 
React native in the wild @ Codemotion 2016 in Rome
React native in the wild @ Codemotion 2016 in RomeReact native in the wild @ Codemotion 2016 in Rome
React native in the wild @ Codemotion 2016 in Rome
 
Building web apps with node.js, socket.io, knockout.js and zombie.js - Codemo...
Building web apps with node.js, socket.io, knockout.js and zombie.js - Codemo...Building web apps with node.js, socket.io, knockout.js and zombie.js - Codemo...
Building web apps with node.js, socket.io, knockout.js and zombie.js - Codemo...
 
Complete MVC on NodeJS
Complete MVC on NodeJSComplete MVC on NodeJS
Complete MVC on NodeJS
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web DevelopmentPHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web Development
 
Webinar - Matteo Manchi: Dal web al nativo: Introduzione a React Native
Webinar - Matteo Manchi: Dal web al nativo: Introduzione a React Native Webinar - Matteo Manchi: Dal web al nativo: Introduzione a React Native
Webinar - Matteo Manchi: Dal web al nativo: Introduzione a React Native
 
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialOSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js Tutorial
 
Node js introduction
Node js introductionNode js introduction
Node js introduction
 
Queue Everything and Please Everyone
Queue Everything and Please EveryoneQueue Everything and Please Everyone
Queue Everything and Please Everyone
 
Introduction to NodeJS
Introduction to NodeJSIntroduction to NodeJS
Introduction to NodeJS
 
Node js for enterprise
Node js for enterpriseNode js for enterprise
Node js for enterprise
 
Node.JS
Node.JSNode.JS
Node.JS
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - DOSUG February 2016
 
Node js for beginners
Node js for beginnersNode js for beginners
Node js for beginners
 
Saving Time By Testing With Jest
Saving Time By Testing With JestSaving Time By Testing With Jest
Saving Time By Testing With Jest
 
Seattlerb why jruby
Seattlerb why jrubySeattlerb why jruby
Seattlerb why jruby
 
Das kannste schon so machen
Das kannste schon so machenDas kannste schon so machen
Das kannste schon so machen
 

Ähnlich wie 9 anti-patterns for node.js teams

История одного успешного ".NET" проекта, Александр Сугак
История одного успешного ".NET" проекта, Александр СугакИстория одного успешного ".NET" проекта, Александр Сугак
История одного успешного ".NET" проекта, Александр СугакSigma Software
 
Understanding & analyzing obfuscated malicious web scripts by Vikram Kharvi
Understanding & analyzing obfuscated malicious web scripts by Vikram KharviUnderstanding & analyzing obfuscated malicious web scripts by Vikram Kharvi
Understanding & analyzing obfuscated malicious web scripts by Vikram KharviCysinfo Cyber Security Community
 
Vulnerability, exploit to metasploit
Vulnerability, exploit to metasploitVulnerability, exploit to metasploit
Vulnerability, exploit to metasploitTiago Henriques
 
Building Open-source React Components
Building Open-source React ComponentsBuilding Open-source React Components
Building Open-source React ComponentsZack Argyle
 
Building Open-Source React Components
Building Open-Source React ComponentsBuilding Open-Source React Components
Building Open-Source React ComponentsZack Argyle
 
Mobile security recipes for xamarin
Mobile security recipes for xamarinMobile security recipes for xamarin
Mobile security recipes for xamarinNicolas Milcoff
 
Getting Started with Node.js
Getting Started with Node.jsGetting Started with Node.js
Getting Started with Node.jsJustin Reock
 
Abusing bleeding edge web standards for appsec glory
Abusing bleeding edge web standards for appsec gloryAbusing bleeding edge web standards for appsec glory
Abusing bleeding edge web standards for appsec gloryPriyanka Aash
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)Chris Cowan
 
How to secure your web applications with NGINX
How to secure your web applications with NGINXHow to secure your web applications with NGINX
How to secure your web applications with NGINXWallarm
 
All about that reactive ui
All about that reactive uiAll about that reactive ui
All about that reactive uiPaul van Zyl
 
Enterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptEnterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptTroy Miles
 
Developer Job in Practice
Developer Job in PracticeDeveloper Job in Practice
Developer Job in Practiceintive
 
Creating Havoc using Human Interface Device
Creating Havoc using Human Interface DeviceCreating Havoc using Human Interface Device
Creating Havoc using Human Interface DevicePositive Hack Days
 
Resisting App Pirates
Resisting App PiratesResisting App Pirates
Resisting App Piratesripeapps
 
What schools should be teaching IT students
What schools should be teaching IT studentsWhat schools should be teaching IT students
What schools should be teaching IT studentsAndy Lester
 
Webhooks with Azure Functions - Live 360 Conference
Webhooks with Azure Functions - Live 360 ConferenceWebhooks with Azure Functions - Live 360 Conference
Webhooks with Azure Functions - Live 360 ConferenceSparkPost
 

Ähnlich wie 9 anti-patterns for node.js teams (20)

История одного успешного ".NET" проекта, Александр Сугак
История одного успешного ".NET" проекта, Александр СугакИстория одного успешного ".NET" проекта, Александр Сугак
История одного успешного ".NET" проекта, Александр Сугак
 
Understanding & analyzing obfuscated malicious web scripts by Vikram Kharvi
Understanding & analyzing obfuscated malicious web scripts by Vikram KharviUnderstanding & analyzing obfuscated malicious web scripts by Vikram Kharvi
Understanding & analyzing obfuscated malicious web scripts by Vikram Kharvi
 
Vulnerability, exploit to metasploit
Vulnerability, exploit to metasploitVulnerability, exploit to metasploit
Vulnerability, exploit to metasploit
 
Building Open-source React Components
Building Open-source React ComponentsBuilding Open-source React Components
Building Open-source React Components
 
Building Open-Source React Components
Building Open-Source React ComponentsBuilding Open-Source React Components
Building Open-Source React Components
 
Mobile security recipes for xamarin
Mobile security recipes for xamarinMobile security recipes for xamarin
Mobile security recipes for xamarin
 
Getting Started with Node.js
Getting Started with Node.jsGetting Started with Node.js
Getting Started with Node.js
 
Abusing bleeding edge web standards for appsec glory
Abusing bleeding edge web standards for appsec gloryAbusing bleeding edge web standards for appsec glory
Abusing bleeding edge web standards for appsec glory
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)
 
How to secure your web applications with NGINX
How to secure your web applications with NGINXHow to secure your web applications with NGINX
How to secure your web applications with NGINX
 
All about that reactive ui
All about that reactive uiAll about that reactive ui
All about that reactive ui
 
From Web to Mobile with Stage 3D
From Web to Mobile with Stage 3DFrom Web to Mobile with Stage 3D
From Web to Mobile with Stage 3D
 
Anti patterns part 2
Anti patterns part 2Anti patterns part 2
Anti patterns part 2
 
Enterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptEnterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScript
 
Developer Job in Practice
Developer Job in PracticeDeveloper Job in Practice
Developer Job in Practice
 
Creating Havoc using Human Interface Device
Creating Havoc using Human Interface DeviceCreating Havoc using Human Interface Device
Creating Havoc using Human Interface Device
 
Developer Week
Developer WeekDeveloper Week
Developer Week
 
Resisting App Pirates
Resisting App PiratesResisting App Pirates
Resisting App Pirates
 
What schools should be teaching IT students
What schools should be teaching IT studentsWhat schools should be teaching IT students
What schools should be teaching IT students
 
Webhooks with Azure Functions - Live 360 Conference
Webhooks with Azure Functions - Live 360 ConferenceWebhooks with Azure Functions - Live 360 Conference
Webhooks with Azure Functions - Live 360 Conference
 

Kürzlich hochgeladen

SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 

Kürzlich hochgeladen (20)

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 

9 anti-patterns for node.js teams

  • 1. 9 anti-patterns for node.js teams Jeff Harrell @juxtajeff
  • 2. Node first went live on paypal.com in 2013. Since: • 35 apps live (marketing, signup, account, payments, etc). • 400 new JavaScript engineers • 500,000 npm installs per day (internally) Made a good deal of mistakes to learn from
  • 3. Anti-pattern #1 Baggage from your previous technology
  • 4. • "Node doesn't support x. It won’t work" • “How do I deal with npm version conflicts?” • “Can’t let the app restart. It takes too long”
  • 5. Leave your baggage behind." ! Except when you’re flying
  • 7. • Use an internal npm instance • Publish modules vs. embedding functionality • Don’t overload modules – compose them Prefer different user, credit card and bank modules Avoid a single “shared” module
  • 8. Build with many blocks, not one."
  • 9. Anti-pattern #3 Googling “How to do x in JavaScript”
  • 10. • jQuery results dominate search engines • Understand ES5 • Be aware of what’s coming in ES6
  • 11. Learn JavaScript before diving in." !
  • 13. • Use an Error object, not a string • Throwing is for programmer errors • Restart on uncaught exception vs ignoring it
  • 14. Error cases are hard." ! Make sure to deal with them
  • 15. Anti-pattern #5 Wrapping everything in promises
  • 16. • Use for the right reasons (not throw or waterfall) • Modules should expose callback interfaces • Use promises sparingly in hot code 27% of CPU time spent in promise execution
  • 18. Anti-pattern #6 Git URLs in your package.json
  • 19. • Git URLs don’t fully leverage semver • Weird caching issues • Unstable state (akin to force overwriting in npm)
  • 20. Publish to npm." ! Set it up internally and use it
  • 22. • Understand control flow patterns • Don’t create crazy waterfalls Hoist functions Use promises (appropriately) Use async • Callback with code afterwards, but no return if (true) { callback(); } fallback();
  • 23. Use good async patterns." ! Queue funny mis-ordered async sentence
  • 24. Anti-pattern #8 Having node do everything
  • 25. • SSL termination should be done by nginx • Heavy encryption is not for node • Don’t bind directly to port 80/443 “How do I enable gzip?” “How do I add an SSL cert to my app?”
  • 26. Best tool, meet job." !
  • 27. Anti-pattern #9 Ignoring the node ecosystem
  • 28. • npm has a wealth of pre-written code • Get updates from community, e.g. Node Security • Conferences like this
  • 29. Embrace your new community." ! Warning: May contain drama
  • 30. Thanks!" ! Q&A is over drinks later!
  • 31. Photo Credits 1. https://www.flickr.com/photos/11334694@N00/268023465/ 2. https://www.flickr.com/photos/14125773@N00/14205159881/ 3. https://www.flickr.com/photos/60364452@N00/3921008904/ 4. https://www.flickr.com/photos/83099438@N00/5902730038 5. https://www.flickr.com/photos/82402200@N00/523497824/ 6. https://www.flickr.com/photos/48553010@N00/113694992/ 7. https://www.flickr.com/photos/46889122@N03/4304137088/ 8. https://www.flickr.com/photos/39039882@N00/5189290606/ 9. https://www.flickr.com/photos/43145783@N00/1852428153/