Home twitter


Objects & Classes and Objects & Classes and Objects & Classes and ES6.

June 7, 2020

CommonJS versus Modules. What's the difference, aside from 'require' versus 'import' statements? Enough of a difference, I'm discovering, to warrant some subtle differences in app design. Node apps seem to be typically written in CommonJS format, a format that centers on ES5 syntax. 'Modern' JavaScript, or ES6, is what the module format is based on, and there seems to be very little in the way of help regarding app creation with this syntax.

And honestly, I think ES6 and up is far prettier and cleaner.

Anyway, today is another day chalked up to reading. I've bookmarked a few sites that I feel will be useful when I return to converting my main project to modules. However, I think I need to settle back and just LEARN some shit; get a good handle on those things that I have limited experience with. Like classes. And constructors. For example, what the hell is 'super()'? What the hell does the 'call' method really do? There's a lot I'm left learning about on my own as it wasn't explained very well or avoided altogether in my certification course.

I keep going back and forth between studying what I need to learn and writing and editing code. Rather than learn a thing and get all excited about implementing that thing before I thoroughly understand the thing, I need to sit with the thing to at least get a good handle of the thing so I actually know what I'm doing with the thing. Because right now, I feel like I really know and understand about 40% of what I'm doing, and I'm guessing the rest of the time.

Oh, and if you didn't pick up on it, the title is a play on Bassnectar's 'Upside Down.'