Lately in putting together my module/namespace example in JavaScript, I've started using Node.js and its module system. While working with it, I've started to use it's read-eval-print loop (REPL), it's been very handy. I thought it'd be useful if I compared Node.js's REPL with the REPL I've used in Chrome (I believe that the one on Chrome is based on a similar loop in Firefox's Firebug).
So first, Chrome's REPL is packaged with it's developer tools. Those tools are web-centric, as you'd expect, and to use them for JavaScript development you need to have an HTML file that pulls together all your JavaScript files. It integrates well with JavaScript testing frameworks like Jasmine, and has a fabulous graphical JavaScript debugger. Overall, the only downside of the Chrome REPL is that you need to use it via web-ish interfaces (e.g. you can load the HTML file from a filesystem, but you still need to have an HTML file in place, and your JavaScript files can't reference CommonJS or Node.js environmental artifacts like require(.)).
Node.js's REPL is handy because you can run JavaScript code directly from the command line, no browser required. Shortcomings I'm running into currently include the lack of a unit testing environment for explicit command line use (Jasmine does claim to integrate with Node.js and other command line tools though) and a rougher debugger. Node.js does have a command-line debugger that works just fine, but it's just not as slick as Chrome's graphical debugger.
I've currently transitioned to using Node.js's REPL, and in the future I'll experiment with Jasmine to see how well it integrates with Node.js's command line environment.
No comments:
Post a Comment