Data Hiding, Instances, and Better Testing with JS Factories and Closures

I’ve been working a lot with NodeJS modules but more these days it’s ES6 modules usually when I design JS applications. The problem with this approach is that ES6 modules are by nature a singleton. They do hide state in terms of the fact that variables and functions inside an ES6 module are local to the module (that’s why you export the ones you do want as part of…



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Dave Schinkel

Software Crafter, XP Coach. Past: Sr. Software Artisan at Pillar Tech, Lead Crafter at 8th Light. Test Driven Development Practitioner. I run