The Work and Flow of JavaScript Development: Maintenance and Ongoing Development

This post is the fourth and final installment in a series on The Work and Flow of JavaScript Development. The first three posts covered Getting Started, Continuous Delivery and Feature Implementation.

The first three posts in my series on The Work and Flow of JavaScript Development took us through implementing a basic user story. Now that we’ve completed that part of the process, we’re ready to discuss how to bridge the gap between what we’ve built so far and a full-featured, multi-region, interactive website application.

Waterfall

Other capabilities and practices

Error Handling in an application is fundamental to keeping errors, logging, and exceptions under control. JavaScript’s asynchronous nature makes standard error handling a little more difficult to implement than with synchronous languages. There are the standard try-catch blocks of code, similar to the code shown for synchronous JavaScript.

try {
doSynchronousStuff(function (error) {
if (error)
throw (error);
/* do normal expected things */
});
} catch (exception) {
callback(exception);
} 

In this example snippet, I’ve shown the function with the error that may occur being caught in an if statement. If the error has occurred, the throw statement then raises the actual error. The catch statement then takes the thrown error, which is now built into an exception. The code snippet then acts on it by executing a callback with the exception itself.

The best solution, however, is not to use the standard try-catch block of code as shown above, but instead to use async callbacks and other asynchronous methods to ensure that an error is thrown or called when the error actually happens. Having an error disappear or be swallowed by the executing application can cause unimaginable headaches when troubleshooting.

Another technology being implemented with Node.js is the domain feature. (As of Node.js v0.10.29, the domain feature is still marked in an unstable state, use with caution!) Domains provide a way to handle multiple I/O operations as a group that acts as a single atomic unit. That unit then exits with a related error code when an error occurs. This creates more options around throwing and collecting errors for troubleshooting and resolution.

Localization: The ability to provide services and support to a multitude of people around the world is extremely important in Web applications. Fortunately, a number of tooling implementations provide multiple language support.

But proper localization involves more than just supporting different languages. The screen rendering may need to change both left-right and top-bottom because different languages flow in different directions. The length of the wording, button, labeling, and header placements all need to be flexible.

One framework that provides multiple language support across apps is i18n-abide. It lets you set up supported languages, a default language, and a translation dictionary. Below is a basic setup for multiple languages with the default set to English:

app.use(i18n.abide({
supported_languages: ['en-US', 'de', 'es', 'zh-TW'],
default_lang: 'en-US',
translation_directory: 'static/i18n'
}));

Ongoing maintenance and development

Keeping the process flow simple and lean helps keep my efforts in order. Of the many programming teams I’ve led, few have wanted and none have needed more than a simple Kanban to manage the most complex of efforts. Keeping things minimal and lean helps to maintain a focus on good development practices and create a product that everyone can be proud of.

An easy way to determine application and code quality is to demo the code to fellow team members and have everyone provide feedback. I’m talking about a fun event: Get together and eat lunch, check out the code, and discuss things that might be added, changed or deleted. Peer review can tricky, however. The team and all involved have to understand respectful feedback and interactions. Maintaining this level of communication is critical to keeping a solid work and flow going.

When building out a project for the first time, all these considerations can seem overwhelming. But they are of major importance. A healthy, long-lived project requires effective processes and the right tools for the work. A well-structured, designed, and implemented architecture can be the difference between a failed project and creating a pinnacle of design and implemented efficiency.

Be sure to check out the earlier installments in our series on “The Work and Flow of JavaScript Development:”
1. Getting Started
2. Continuous Delivery
3. Feature Implementation

Water flow image courtesy of Shutterstock.com.

adronhall@gmail.com'

Adron Hall is a jovial, proactive, test & code, code & test, get things done well, software architect, engineer, code monkey, coder, and distributed systems advocate. As a coder, Hall plies a polygot language path including C#, Java, JavaScript, and Erlang lately -- as well as Pascal, Basic, Visual Basic, C++, C, COBOL, RPG, CL, and others in the past. He founded Deconstructed.io with Aaron Gray, Node PDX with Troy Howard, and more startups are in the works. You can read his blog at Composite Code (http://compositecode.com). View posts by .

Interested in writing for New Relic Blog? Send us a pitch!