Marc Harter

Author information TBD.

Blog posts by Marc Harter

Systematic Data Design in JavaScript – Featuring Three Data Types

Apr 18, 2017

Note: This blog post is also available at IBM DeveloperWorks. In the previous article, we discussed systematic function design: a test, example, and documentation-driven approach to designing functions using the HtDP methodology. In this post, we... More

Systematic Function Design in JavaScript

Nov 15, 2016

Note: This blog post is also available at IBM DeveloperWorks. Habits can be damning or liberating. Perhaps you are like me. I know having tests, examples, and documentation are good things for any program but why do they always seem to be an a... More

Promises in Node.js – An Alternative to Callbacks

Aug 24, 2016

Note: This blog post is also available at IBM DeveloperWorks. Promises are a compelling alternative to callbacks when dealing with asynchronous code. Unfortunately, promises can be confusing and perhaps you’ve written them off. However, significa... More

Auto-fixing & Formatting Your JavaScript with ESLint

Jul 27, 2016

Note: This blog post is also available at IBM DeveloperWorks. Linting is the process of running a program that will analyze your code for potential errors. A lint program does this by using a set of rules applied to your code to determine if a... More

Surviving ECMAScript 6

Jul 7, 2016

I recently watched an insightful talk from Rob Pike where he shared his experience attending Lang.Next, a conference focusing on new and upcoming trends in programming languages. While there, Rob noticed how many presenters focused on things they ... More

Tips for Optimizing Slow Code in Node.js

Jan 6, 2016

Note: This blog post is also available on IBM DeveloperWorks. Node.js programs can be slow due to CPU or IO bound operations. On the CPU side, typically there is a “hot path” (a code that is visited often) that is not optimized. On the IO side, l... More

The Foundations of Universal (or Isomorphic) JavaScript

Sep 11, 2015

In the last tutorial, we wrote a Node program using Babel. This allowed us to use ES6 features now and experiment with new language proposals in a backwards-compatible way. We looked at testing, linting, and running programs in production. Now le... More

Making the most of JavaScript’s “future” today with Babel

Jul 30, 2015

From CoffeeScript to ClojureScript to PureScript to CobolScript to DogeScript (woof woof!), JavaScript is the write-once-run-anywhere target for many forms and styles of programming. Yet, its biggest compile-to-language today actually isn’t any... More

Asynchronous Error Handling in Express with Promises, Generators and ES7

Apr 21, 2015

tldr; Callbacks have a lousy error-handling story. Promises are better. Marry the built-in error handling in Express with promises and significantly lower the chances of an uncaught exception. Promises are native ES6, can be used with generator... More

Roll your own Node.js CI Server with Jenkins – Part 1

Jan 12, 2015

Travis is cool. Coveralls is hip. But Jenkins has had this stuff for a while, and more. In addition to running your test suite and generating coverage reports, you can generate checkstyle reports (linting), deploy to staging and production, and ut... More

Roll your own Node.js CI Server with Jenkins – Part 2

Jan 12, 2015

In the first article, we focused on setting up Jenkins and configuring it to support Node projects. Please complete those steps if you haven’t already. In this part, we will add an actual Node project to Jenkins with the following hotness: Co... More

Writing Modular Node.js Projects for Express and Beyond

Oct 21, 2014

I have worked with Express for over four years now and I cannot count how many different ways I have reorganized my code! Express bills itself as an un-opinionated framework. This is true. If you search for “express boilerplate” you will find a lo... More

Generators in Node.js: Common Misconceptions and Three Good Use Cases

May 6, 2014

Generators have been all the rage lately. Many Node developers (including myself!) are excited and intrigued about writing their asynchronous code like this: var a = yield doAsyncFn() var b = yield doAyncFnThatDependsOnA(a) console.log(b) Howev... More

Managing Node.js Callback Hell with Promises, Generators and Other Approaches

Feb 3, 2014

We know it most endearingly as “callback hell” or the “pyramid of doom”: doAsync1(function () { doAsync2(function () { doAsync3(function () { doAsync4(function () { }) }) }) Callback hell is subjective, as heavily nested code ... More

Building Robust Node Applications: Error Handling

Jan 7, 2014

Update 9-29-15: Domains are now deprecated in Node 4.x. I’ve crashed more Node processes in production than I’d like to admit. Thankfully, I’ve then learned how to build robustness into my Node applications. So, what can you build into your a... More

Template Systems in Node.js

Dec 10, 2013

Regardless of your background in web development, you’ve likely used a web template system (engine). The goal of a template system is to process templates (usually in combination with a set of input data) to form finalized web pages. template(... More

Real-time Engines in Node.js

Nov 14, 2013

Node arrived on the scene around the time the WebSocket protocol was drafted. Node’s fast, evented approach to server-side programming was a perfect pairing for WebSocket. Out of that marriage emerged the popular framework: an instant ... More

How-to: Heap Snapshots and Handling Node.js Memory Leaks

Oct 2, 2013

_In the beginning, there were memory leaks in JavaScript … and we could not have cared less._ _Then there was Ajax … and we started to care._ _Then there were these long-running Node processes on our production servers … and we really cared a... More

How to Compose Node.js Promises with Q

Aug 14, 2013

In the last article on promises, we focused on the Promises/A+ specification and Q implementation of promises. We learned the benefits of using promises over raw callbacks. Now, we’re going to take it up a notch and focus on promise composition, w... More

Promises in Node.js with Q – An Alternative to Callbacks

Jul 2, 2013

Note: This blog post is also available at IBM DeveloperWorks. The author has provided an updated version of this article, which you can read here. Promises provide a compelling alternative to raw callbacks when dealing with asynchronous code. U... More

Practical Examples of the New Node.js Streams API

May 29, 2013

Node brought a simplicity and beauty to streaming.  Streams are now a powerful way to build modules and applications.  Yet the original streams API had some problems.  So in Node v0.10, we saw the streams API change in order to fix the prior probl... More