It’s 2 AM, just hours before development is set to begin on your new multimillion-dollar project. While everyone else is sleeping, you’re wide-awake in a cold sweat. “Is that framework we selected really the right one?” you’re wondering. “Will we regret it later?”

Sound familiar? Rest assured, you’re not alone! New JavaScript frameworks are under development at a mind-boggling rate, and selecting the right one is a crucial decision. Choose wisely and your application should see lower development and maintenance costs throughout its lifetime. Choose poorly and you could wind up with an unsupported codebase, few development resources available, and maintenance costs that spiral out of control as the application grows.

To make matters worse, the cost of changing frameworks can be prohibitively high. So this is a key decision that you must make at a time when you have the least amount of information about your project: The very beginning.

Before you plunk down all your chips on the latest fad framework, let’s take a look at how to make a solid and informed decision, so you can architect your code to stand the test of time.

Understand your needs

This may seem obvious, but it’s also an easy step to overlook: make sure to understand your needs.

Will your application be presenting large tables of data? Will it require a short, frequent build cycle? Will it be used on mobile devices? Each framework has its own particular strengths and weaknesses. The choice will depend on the needs of your application. Before you begin comparing options, make a formal written list of those needs so that you can make a visual comparison.

Stand on the shoulders of giants

Sometimes it pays to be different and go against the flow, but choosing the technology foundation for your application is not one of those times. By tending toward the larger, more popular frameworks that are supported by industry giants such as Google or Facebook, you are ensuring that your development team will have a larger talent pool to draw from when resources are needed, greater support both online and off, and a plethora of information and solutions available. All of these are important factors in reducing the total cost of ownership. It won’t matter that your framework is more efficient if, after a year, you can’t find anyone to maintain it.

Once you have your needs identified and a list of the major frameworks, it’s time to review how they might stack up for your project. Here are just a few examples:

A look at Backbone.js: Lightweight, fast, minimal

If your developers are senior, experienced, and working on a project where speed and performance are top concerns, add Backbone.js to your shortlist. Initially released in 2010, this mature framework enjoys a large pool of online resources and information. However, its minimal and lightweight nature can be a mixed blessing that requires developers to navigate and manage a large number of plugins and libraries. This can escalate development costs as more tools and processes become necessary to manage those dependencies.

AngularJS: Mature, comprehensive, slower

If you require a more comprehensive framework for larger applications that is prescriptive for senior and intermediate developers alike, AngularJS is a serious contender. Maintained by Google, AngularJS provides features such as two-way data binding, routing, and dependency injection that make building larger applications easier. The way that AngularJS prescribes certain development practices can help promote consistency. And being one of the more popular frameworks (due to Google’s support) it is one of the easiest for which to find resources and solutions. However, AngularJS is also known for performance bottlenecks when dealing with large amounts of data.

React: New, fast, but a different paradigm

In 2013, Facebook released React, which quickly rose in popularity and is gaining momentum. Despite being one of the largest frameworks in terms of file size, React is fast! Its use of a virtual document object model (DOM) makes it the fastest in this list by far. However, React tightly couples presentation, logic, and data in a way that could be considered to violate separation of concerns, possibly resulting in an unmaintainable application. When evaluating React, carefully consider the effect this tight coupling may have on your application and the long-term costs that could be incurred.

How to Choose
JavaScript frameworks are far from “one size fits all.” Ultimately the choice of framework will be directed by the size and requirements of your project, as well as the skill set of your team. Other popular frameworks to consider include Ember.js and Web Components. For detailed technical insight, have a look at ToDoMVC.com, a website comparing the same application written using each of the mainstream frameworks.

Create a spreadsheet of your candidate frameworks to compare them across your project’s requirements and constraints. Smaller projects and those with experienced programmers will benefit from React’s performance and Backbone’s lightweight approach, so you may wish to consider these frameworks unless there is a compelling reason not to. On larger projects with a wider range of staff experience, the structure of AngularJS can be a great help in creating a modular, consistent application.

In the end, always remember that the purpose of a framework is merely to simplify and accelerate development, and to help you manage code complexity on large projects. As long as your chosen framework helps your team code faster, and you are sure that the framework itself can be modified and maintained by them, you can rest easy that you made a sound decision and your application will be maintainable for many years to come.